1、
'UIWebView' is deprecated: first deprecated in iOS 12.0 - No longer supported; please adopt WKWebView.
從iOS 12開始不再支持UIWebView控件了, 替換成WKWebView即可
2、
Unknown type name 'WKWebView'; did you mean 'UIWebView'?
iOS8以后,蘋果推出了新框架Webkit,提供了替換UIWebView的組件WKWebView。之前導入UIKit框架#import <UIKit/UIKit.h>不會有問題,現在必須再導入#import <WebKit/WebKit.h>
3、
"Could not instantiate class named WKWebView because no class named WKWebView was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)"
無法初始化WKWebView,因為找不到WKWebView這個類
要想WKWebView這個類完成初始化,需要手動添加WebKit.framework
依次點擊:Target(項目)——>Build Phases——>Link Binary With Libraries
展開,點擊+,在打開的窗口搜索web,找到WebKit.framework選中添加即可
4、
-[__NSCFConstantString substringFromIndex:]: Index 9223372036854775807 out of bounds; string length 0
這個錯誤是使用substringFromIndex:這個方法的時候出現的
假如代碼是這樣寫的
[source substringWithRange:range];
這個錯誤往往是source為空導致的,只要加個判斷if(source.length !=0)再調用方法即可
另外多說一個
range的初始化應該這樣寫NSRange range = NSMakeRange(0, 0);
NSRange在初始化的時候如果用NSRange range;,沒有指定range的初值,有時候就會出現這個錯誤—— Range {9223372036854775808, 18446744073709551615} out of bounds; string length 0
5、
error build: SWIFT_VERSION '3.0' is unsupported, supported versions are: 4.0, 4.2, 5.0.
Build Setting中把Swift Language Version下改為Swift 4或者5即可
6、
[WindowScene] Failed to instantiate the default view controller for UIMainStoryboardFile 'Main' - perhaps the designated entry point is not set?
原因分析:在StoryBoard中沒有一個view controller設置了Initial Scene。
解決方案:在Storyboard中,選擇一個view conroller作為story board的第一啟動界面