我有一个本地的HTML(静态内容和无链接内部)文件,需要在Web视图中加载。我已经使用UIWebView加载它,但升级到Swift 2.0和Xcode 7后,现有的实现在presentViewController这一行崩溃,我们尝试呈现内部具有web视图但以前工作正常的视图控制器。这似乎是因为WebKit介绍的问题,但它不应该影响现有的执行权。所以任何人都可以帮助我,或者建议我走最好的路? 该项目的目标是iOS 8及以上版本(仅iPad)。 这是正在无法在Swift 2.0和Xcode 7中的WebView中加载本地HTML文件
let path = NSBundle.mainBundle().URLForResource("index", withExtension: "html")
let prepareRequest = NSURLRequest(URL: path!)
self.webView.loadRequest(prepareRequest)
感谢
Crash Report
1 0x8707b09 StartWebThread()
2 0x524d6b0 __pthread_once_handler
3 0x523eebe _os_once
4 0x524d65f pthread_once
5 0x870789e WebThreadEnable
6 0x75ce14a +[WebView(WebPrivate) enableWebThread]
7 0x75cad90 WebKitInitialize
8 0x2822a30 ___UIApplicationLoadWebKit_block_invoke
9 0x4f0abef _dispatch_client_callout
10 0x4ef4a92 dispatch_once_f
11 0x4ef4922 dispatch_once
12 0x2822940 _UIApplicationLoadWebKit
13 0x4083461 _class_initialize
14 0x408bfe5 lookUpImpOrForward
15 0x408be8d _class_lookupMethodAndLoadCache3
16 0x409612f objc_msgSend
17 0x2cef77a UINibDecoderDecodeObjectForValue
18 0x2cef9b0 UINibDecoderDecodeObjectForValue
19 0x2cef4c3 -[UINibDecoder decodeObjectForKey:]
20 0x289480c -[UIView initWithCoder:]
21 0x28be337 -[UIScrollView initWithCoder:]
22 0x2cef7ae UINibDecoderDecodeObjectForValue
23 0x2cef4c3 -[UINibDecoder decodeObjectForKey:]
24 0x2b6cbca -[UIRuntimeConnection initWithCoder:]
25 0x2cef7ae UINibDecoderDecodeObjectForValue
26 0x2cef9b0 UINibDecoderDecodeObjectForValue
27 0x2cef4c3 -[UINibDecoder decodeObjectForKey:]
28 0x2b6be80 -[UINib instantiateWithOwner:options:]
29 0x29860d4 -[UIViewController _loadViewFromNibNamed:bundle:]
30 0x298686b -[UIViewController loadView]
31 0x2986a9f -[UIViewController loadViewIfRequired]
2015-10-08
Sandy