这是最近发现的,我刚刚使用iOS 7.1.1将我的Xcode更新到版本5.1.1(5B1008) 因此,当我使用UIwebview创建一个委托时,其崩溃与SIGABRT错误。
以下是我的Xcode崩溃日志,
2014-04-26 11:50:26.890 corporatetoolste[17908:60b] -[UIWebView setNewDelegate:]:
unrecognized selector sent to instance 0x9724d50
2014-04-26 11:50:26.892 corporatetoolste[17908:60b] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[UIWebView setNewDelegate:]:
unrecognized selector sent to instance 0x9724d50'
*** First throw call stack:
(
0 CoreFoundation 0x02b1a1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x028998e5 objc_exception_throw + 44
2 CoreFoundation 0x02bb7243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x02b0a50b ___forwarding___ + 1019
4 CoreFoundation 0x02b0a0ee _CF_forwarding_prep_0 + 14
5 corporatetoolste 0x00084670 -[GDUIWebViewDelegateProxyLayer setDelegate:] + 80
6 Foundation 0x02040204 _NSSetUsingKeyValueSetter + 133
7 Foundation 0x0203f731 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
8 UIKit 0x01033508 -[UIView(CALayerDelegate) setValue:forKey:] + 168
9 Foundation 0x020a1b0a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
10 UIKit 0x0127b1f4 -[UIRuntimeOutletConnection connect] + 106
11 libobjc.A.dylib 0x028ab7de -[NSObject performSelector:] + 62
12 CoreFoundation 0x02b1576a -[NSArray makeObjectsPerformSelector:] + 314
13 UIKit 0x01279d4d -[UINib instantiateWithOwner:options:] + 1417
14 UIKit 0x010e26f5 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
15 UIKit 0x010e2e9d -[UIViewController loadView] + 302
16 UIKit 0x010e30d3 -[UIViewController loadViewIfRequired] + 78
17 UIKit 0x010e35d9 -[UIViewController view] + 35
18 UIKit 0x010fd942 -[UINavigationController _startCustomTransition:] + 778
19 UIKit 0x0110a8f7 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688
20 UIKit 0x0110b4e9 -[UINavigationController __viewWillLayoutSubviews] + 57
21 UIKit 0x0124c0d1 -[UILayoutContainerView layoutSubviews] + 213
22 UIKit 0x1029021b -[UILayoutContainerViewAccessibility(SafeCategory) layoutSubviews] + 50
23 UIKit 0x01033964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
24 libobjc.A.dylib 0x028ab82b -[NSObject performSelector:withObject:] + 70
25 QuartzCore 0x00c8e45a -[CALayer layoutSublayers] + 148
26 QuartzCore 0x00c82244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
27 QuartzCore 0x00c820b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
28 QuartzCore 0x00be87fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
29 QuartzCore 0x00be9b85 _ZN2CA11Transaction6commitEv + 393
30 QuartzCore 0x00ca75b0 +[CATransaction flush] + 52
31 UIKit 0x00fc29bb _UIApplicationHandleEventQueue + 13095
32 CoreFoundation 0x02aa377f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
33 CoreFoundation 0x02aa310b __CFRunLoopDoSources0 + 235
34 CoreFoundation 0x02ac01ae __CFRunLoopRun + 910
35 CoreFoundation 0x02abf9d3 CFRunLoopRunSpecific + 467
36 CoreFoundation 0x02abf7eb CFRunLoopRunInMode + 123
37 GraphicsServices 0x03f885ee GSEventRunModal + 192
38 GraphicsServices 0x03f8842b GSEventRun + 104
39 UIKit 0x00fc4f9b UIApplicationMain + 1225
40 corporatetoolste 0x00005501 main + 177
41 libdyld.dylib 0x03093701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
答案 0 :(得分:0)
UIWebView
没有任何名为setNewDelegate
的方法。检查xib中的webview连接,它似乎有这个设置。
希望有所帮助!
答案 1 :(得分:0)
我遇到了同样的错误并修复了它。
似乎不再允许对UIWebView委托属性进行编程设置,至少不允许对故事板创建的视图进行编程设置。相反,必须在情节提要编辑器中设置delegate属性。
我的应用程序有一个故事板,它只包含一个UIWebView。我之前有一个ViewController类,它是包含UIWebView的控制器的自定义类。还有一个第二个类MainPage,它在ViewController中以编程方式分配并设置为委托。为了解决这个错误,我删除了ViewController类,并将其所有代码和函数替换为MainPage或AppDelegate。视图控制器的自定义类现在是MainPage本身。
干杯,吉姆