几天前,我开始收到用户报告,说明我的应用无法使用。经过几个小时的调查后,我发现控制器没有显示([self.navigationController pushViewController:terminalController animated:YES];
),如果它有UIWebView
并且没有wifi连接!我不相信,但我有2个控制器 - 一个加载'关于应用程序'页面,另一个用于显示一些内置的应用程序文档。我正在测试ios 8.1.2和ipad 2.
控制器的viewDidLoad
只是没有被调用,应用程序只是冻结了。我已经检查过几次 - 如果我打开wifi并重新启动应用控制器就会显示出来!
问题是我使用uiwebview显示本地页面并且它不需要wifi连接,因此大多数用户都非常困惑。
任何解决方法?
更新:这是我推动控制器的方式:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
ASTerminalController *terminalController = [storyboard instantiateViewControllerWithIdentifier:@"ASTerminalController"];
terminalController.htmlFilename = self.outputFilePath;
[self.navigationController pushViewController:terminalController animated:YES];
Update2:我修改了应用程序,现在我创建的UIWebView
不是在故事板中而是在代码中。现在我可以看到initWithFrame
挂起是没有互联网连接:
self.webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
更新1:可能某些第三方代码使用UIWebView并以某种方式阻止它(请参阅使用信号量):
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x3aa34540 semaphore_wait_trap + 8
1 libsystem_platform.dylib 0x3aabf431 _os_semaphore_wait + 9
2 libdispatch.dylib 0x01b966f7 0x1b94000 + 9975
3 UIKit 0x2ff893ef +[UIWebDocumentView initialize] + 39
4 libobjc.A.dylib 0x3a4024d5 _class_initialize + 533
5 libobjc.A.dylib 0x3a4022fd _class_initialize + 61
6 libobjc.A.dylib 0x3a40805b lookUpImpOrForward + 251
7 libobjc.A.dylib 0x3a407f53 _class_lookupMethodAndLoadCache3 + 31
8 libobjc.A.dylib 0x3a40e1d7 _objc_msgSend_uncached + 23
9 UIKit 0x2fe743d1 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) containerIsBrowserView] + 73
10 UIKit 0x2fe74353 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) textDocument] + 35
11 UIKit 0x2fe74271 -[UITextSelectionView selection] + 41
12 UIKit 0x2fe74e7f -[UITextSelectionView selectionChanged] + 167
13 UIKit 0x304f17bb __47-[UITextInputController _setSelectedTextRange:]_block_invoke251 + 223
14 UIKit 0x2fe74d8b __52-[UITextInputController _coordinateSelectionChange:]_block_invoke + 83
15 UIFoundation 0x3756bb63 -[NSTextStorage coordinateReading:] + 35
16 UIKit 0x2fe74d31 -[UITextInputController _coordinateSelectionChange:] + 97
17 UIKit 0x304f14d3 -[UITextInputController _setSelectedTextRange:] + 599
18 UIKit 0x2feda6db -[UITextView setAttributedText:] + 391
19 CppCode 0x0011b925 0xd1000 + 305445
20 CppCode 0x0011d0cb 0xd1000 + 311499
21 CppCode 0x00119daf 0xd1000 + 298415
22 CoreFoundation 0x2c931c5f __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 11
23 CoreFoundation 0x2c88d6d1 _CFXNotificationPost + 1781
24 Foundation 0x2d5bf125 -[NSNotificationCenter postNotificationName:object:userInfo:] + 69
25 Foundation 0x2d5ebe33 -[NSUserDefaults(NSUserDefaults) registerDefaults:] + 71
26 WebKitLegacy 0x389df8cd +[WebView initialize] + 301
27 libobjc.A.dylib 0x3a4024d5 _class_initialize + 533
28 libobjc.A.dylib 0x3a40805b lookUpImpOrForward + 251
29 libobjc.A.dylib 0x3a407f53 _class_lookupMethodAndLoadCache3 + 31
30 libobjc.A.dylib 0x3a40e1d7 _objc_msgSend_uncached + 23
31 WebKitLegacy 0x389df6cf WebKitInitialize + 67
32 UIKit 0x3009cf97 ___UIApplicationLoadWebKit_block_invoke + 151
33 libdispatch.dylib 0x01b959c5 0x1b94000 + 6597
34 libdispatch.dylib 0x01b9662d 0x1b94000 + 9773
35 libobjc.A.dylib 0x3a4024d5 _class_initialize + 533
36 libobjc.A.dylib 0x3a40805b lookUpImpOrForward + 251
37 libobjc.A.dylib 0x3a407f53 _class_lookupMethodAndLoadCache3 + 31
38 libobjc.A.dylib 0x3a40e1d7 _objc_msgSend_uncached + 23
39 CppCode 0x0011182d 0xd1000 + 264237
40 UIKit 0x2fe3a52b -[UIViewController loadViewIfRequired] + 599
41 UIKit 0x2fe3a299 -[UIViewController view] + 21
42 UIKit 0x2ffc3585 -[UINavigationController _startCustomTransition:] + 625
43 UIKit 0x2fee34d3 -[UINavigationController _startDeferredTransitionIfNeeded:] + 419
44 UIKit 0x2fee32d9 -[UINavigationController __viewWillLayoutSubviews] + 41
45 UIKit 0x2fee326d -[UILayoutContainerView layoutSubviews] + 181
46 UIKit 0x2fe37a6b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 511
47 QuartzCore 0x2f85fa09 -[CALayer layoutSublayers] + 133
48 QuartzCore 0x2f85b3e1 CA::Layer::layout_if_needed(CA::Transaction*) + 357
49 QuartzCore 0x2f85b269 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 13
50 QuartzCore 0x2f85ac4d CA::Context::commit_transaction(CA::Transaction*) + 221
51 QuartzCore 0x2f85aa51 CA::Transaction::commit() + 321
52 QuartzCore 0x2f854929 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 53
53 CoreFoundation 0x2c93fd93 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 19
54 CoreFoundation 0x2c93d44f __CFRunLoopDoObservers + 275
55 CoreFoundation 0x2c93d857 __CFRunLoopRun + 911
56 CoreFoundation 0x2c88b3bd CFRunLoopRunSpecific + 473
57 CoreFoundation 0x2c88b1cf CFRunLoopRunInMode + 103
58 GraphicsServices 0x33c200a5 GSEventRunModal + 133
59 UIKit 0x2fe997ad UIApplicationMain + 1437
60 CppCode 0x0011f619 0xd1000 + 321049
61 libdyld.dylib 0x3a981aad start + 1