Question

This is Recently Discovered , I just Updated my Xcode to Version 5.1.1 (5B1008) with iOS 7.1.1 So when i Created a Delegate with UIwebview its Crashing with SIGABRT Error .

Here are my Xcode Crash Logs ,

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) 
Was it helpful?

Solution

UIWebView does not have any method named setNewDelegate. Check your webview connections in xib, it seems to have this set.

Hope that helps!

OTHER TIPS

I encountered the same error and have fixed it.

It seems that programmatic setting of the UIWebView delegate property is no longer allowed, at least not for views created by storyboards. Instead, the delegate property must be set in the storyboard editor.

My application has one storyboard, which contains only a UIWebView. I previously had a ViewController class, which was the custom class of the controller that contained the UIWebView. There was also a second class, MainPage, which was allocated and set to be the delegate programmatically in the ViewController. To fix this error, I removed the ViewController class and displaced all its code and function to either MainPage or the AppDelegate. The custom class of the view controller is now MainPage itself.

Cheers, Jim

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top