swift找不到html文件路径,无法在Swift 2.0和Xcode 7中的WebView中加载本地HTML文件

我有一个本地的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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值