I'm trying to add an ad package on an app. I've done it on another project, it worked. But here I'm having a mysterious error, that never happened before. Could you help me to trace it ?
Could you help me to trace this error ?
2011-08-29 13:22:12.012 MeoCampus[45962:207] -[AdRequest initWithPageId:formatId:master:target:creator:request:requestDelegate:]: unrecognized selector sent to instance 0x633aa20
2011-08-29 13:22:12.015 MeoCampus[45962:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AdRequest initWithPageId:formatId:master:target:creator:request:requestDelegate:]: unrecognized selector sent to instance 0x633aa20'
*** Call stack at first throw:
(
0 CoreFoundation 0x018925a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x019e6313 objc_exception_throw + 44
2 CoreFoundation 0x018940bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x01803966 ___forwarding___ + 966
4 CoreFoundation 0x01803522 _CF_forwarding_prep_0 + 50
5 MeoCampus 0x000a1e92 -[SASApi downloadAdWithFormatId:pageId:master:target:creator:timeout:] + 235
6 MeoCampus 0x000a7a64 -[SmartAdServerView loadFormatId:pageId:master:target:timeout:] + 401
7 MeoCampus 0x000a7ab3 -[SmartAdServerView loadFormatId:pageId:master:target:] + 71
8 MeoCampus 0x00004623 -[HomeViewController viewDidLoad] + 483
9 UIKit 0x00c57089 -[UIViewController view] + 179
10 UIKit 0x00c55482 -[UIViewController contentScrollView] + 42
11 UIKit 0x00c65f25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
12 UIKit 0x00c64555 -[UINavigationController _layoutViewController:] + 43
13 UIKit 0x00c65870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
14 UIKit 0x00c6032a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
15 UIKit 0x00d7b2e9 -[UILayoutContainerView layoutSubviews] + 226
16 QuartzCore 0x00203a5a -[CALayer layoutSublayers] + 181
17 QuartzCore 0x00205ddc CALayerLayoutIfNeeded + 220
18 QuartzCore 0x001ab0b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
19 QuartzCore 0x001ac294 _ZN2CA11Transaction6commitEv + 292
20 UIKit 0x00ba99c9 -[UIApplication _reportAppLaunchFinished] + 39
21 UIKit 0x00ba9e83 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 690
22 UIKit 0x00bb4617 -[UIApplication handleEvent:withNewEvent:] + 1533
23 UIKit 0x00bacabf -[UIApplication sendEvent:] + 71
24 UIKit 0x00bb1f2e _UIApplicationHandleEvent + 7576
25 GraphicsServices 0x02199992 PurpleEventCallback + 1550
26 CoreFoundation 0x01873944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
27 CoreFoundation 0x017d3cf7 __CFRunLoopDoSource1 + 215
28 CoreFoundation 0x017d0f83 __CFRunLoopRun + 979
29 CoreFoundation 0x017d0840 CFRunLoopRunSpecific + 208
30 CoreFoundation 0x017d0761 CFRunLoopRunInMode + 97
31 UIKit 0x00ba97d2 -[UIApplication _run] + 623
32 UIKit 0x00bb5c93 UIApplicationMain + 1160
33 MeoCampus 0x000023e9 main + 121
34 MeoCampus 0x00002365 start + 53
)
terminate called after throwing an instance of 'NSException'
Here is the code that create the ad:
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
//Intialize the SmartAdServerView object. This example is for a banner on the iPhone, you can specify any frame you want.
//By convention, banners have a ratio aspect of 6:1 in portrait mode, so if you have borders in your application, you should adapt the ad's height. The creative will be adapted to your view's frame, but it will look better if they have the same size.
//The iPad recommended height, with a 6:1 ratio is 128 pixels
SmartAdServerView *banner = [[SmartAdServerView alloc] initWithFrame:CGRectMake(.0,315.0,320.0,53.0) loader:SmartAdServerViewLoaderActivityIndicatorStyleWhite];
//Set an auto-resizing mask, for the view to adapt it's size when it's superview is resized (after a rotation for example). Typically a banner keep it's height and adapt it's width.
banner.autoresizingMask = UIViewAutoresizingFlexibleWidth;
//Set the banner to stay in place, so it won't be removed automatically.
banner.unlimited = YES;
//Set your ad's delegate, which will be the presentator of ad's modal view to the user, and will be notified of significative events
banner.delegate = self;
NSLog(#"set the delegate.");
NSLog(#"the delegate is = %#", [[banner delegate] class]);
//Load the ad with your settings
//The siteId can be a string in some rare cases, this is why you have to pass an NSString
//One ad per page of your application should have the "YES" for the "master" argument, and the other should have "NO", this is for page view counting.
//[banner loadFormatId:12345 pageId:#"98765" master:YES target:nil];
//Display the ad to the user, here we assume that we are in a UIViewController
[self.view addSubview:banner];
self.myAd = banner;
[banner release];
}
Thanks a lot.
I contacted the ad operator. Thanks you all.
Search for initWithPageId:formatId:master:target:creator:request:requestDelegate: method in your code. You are calling it for an object that does not recognize it.
Related
TL&DR;
Setting a custom property of a subclass of UIBarButtonItem using UIAppearance proxy is causing the "unrecognized selector" exception, beause the setter is probably being forwarded by UIAppearance to UINavigationButton, not the bar button itself.
SDK overview
I am using iOS 7 Beta 5 SDK with Xcode 5 DP5. But please, don't tell me that it is under NDA, because I do not discuss any new features or new classes in this question. I inform you of my SDK, because it can be found out that it's just a bug in the beta software.
What I did
I subclassed a UIBarButtonItem and created a custom property in the header file:
#property (nonatomic, strong) NSString *mySubclassedProperty UI_APPEARANCE_SELECTOR;
My setter and getter look like this:
- (void)setMySubclassedProperty:(NSString *)mySubclassedProperty {
_mySubclassedProperty = mySubclassedProperty;
NSLog(#"%p %s %#", self, __PRETTY_FUNCTION__, mySubclassedProperty);
}
Nothing special, huh? But it doesn't work with UIAppearance at all. When I try to set the default appearance in my application's delegate, it gives me no error, no warning, whatsoever.
[[AKBarButtonItem appearance] setMySubclassedProperty:#"GLOBALLY ASSIGNED"];
The crash
It seems to be working like a charm, except of the fact that it crashes when I try to set an instance of AKBarButtonItem to self.navigationItem.rightBarButtonItem:
self.navigationItem.rightBarButtonItem = [[AKBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:nil action:nil];
The backtrace looks like this:
2013-08-13 14:30:08.551 UIBarButtonItem Subclass Demo[1512:a0b] -[UINavigationButton setMySubclassedProperty:]: unrecognized selector sent to instance 0x8c42710
2013-08-13 14:30:08.556 UIBarButtonItem Subclass Demo[1512:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UINavigationButton setMySubclassedProperty:]: unrecognized selector sent to instance 0x8c42710'
*** First throw call stack:
(
0 CoreFoundation 0x0173b6f4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x014bb8b6 objc_exception_throw + 44
2 CoreFoundation 0x017d8983 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0172ba1b ___forwarding___ + 1019
4 CoreFoundation 0x0172b5fe _CF_forwarding_prep_0 + 14
5 CoreFoundation 0x0172fe2d __invoking___ + 29
6 CoreFoundation 0x0172fd3a -[NSInvocation invoke] + 362
7 CoreFoundation 0x0172feba -[NSInvocation invokeWithTarget:] + 74
8 UIKit 0x00763255 workaround10030904InvokeWithTarget + 824
9 UIKit 0x0075dea8 +[_UIAppearance _applyInvocationsTo:window:matchingSelector:] + 4497
10 UIKit 0x0075e299 +[_UIAppearance _applyInvocationsTo:window:] + 55
11 UIKit 0x0029ddcb -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 183
12 libobjc.A.dylib 0x014cd81f -[NSObject performSelector:withObject:] + 70
13 QuartzCore 0x03ac172a -[CALayer layoutSublayers] + 148
14 QuartzCore 0x03ab5514 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
15 QuartzCore 0x03ac3b55 -[CALayer(CALayerPrivate) layoutBelowIfNeeded] + 43
16 UIKit 0x00290886 -[UIView(Hierarchy) layoutBelowIfNeeded] + 595
17 UIKit 0x0029062d -[UIView(Hierarchy) layoutIfNeeded] + 74
18 UIKit 0x0050841e -[UIBarButtonItem(UIStatic) _leftRightImagePaddingForEdgeMarginInNavBarIsMini:] + 574
19 UIKit 0x002ea325 -[UINavigationBar _getTitleViewFrame:leftViewFrames:rightViewFrames:forItemAtIndex:returnedIdealWidthOfTextContent:availableLayoutWidthForTextContent:idealBackButtonWidth:] + 3522
20 UIKit 0x002ef2da -[UINavigationBar _getTitleViewFrame:leftViewFrames:rightViewFrames:forItemAtIndex:] + 591
21 UIKit 0x002ef59a -[UINavigationBar _getTitleViewFrame:leftViewFrames:rightViewFrames:] + 151
22 UIKit 0x002dc515 -[UINavigationBar _setLeftViews:rightViews:] + 1894
23 UIKit 0x002ca6c5 -[UINavigationItem updateNavigationBarButtonsAnimated:] + 188
24 UIKit 0x002cab63 -[UINavigationItem setObject:forLeftRightKeyPath:animated:] + 547
25 UIKit 0x002cb1ae -[UINavigationItem setRightBarButtonItem:animated:] + 171
26 UIKit 0x002cb0fe -[UINavigationItem setRightBarButtonItem:] + 48
27 UIBarButtonItem Subclass Demo 0x0000665e -[AKViewController viewDidLoad] + 222
28 UIKit 0x00345c18 -[UIViewController loadViewIfRequired] + 696
29 UIKit 0x00345eb4 -[UIViewController view] + 35
30 UIKit 0x00370369 -[UINavigationController rotatingSnapshotViewForWindow:] + 52
31 UIKit 0x00698e10 -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 420
32 UIKit 0x00276ff2 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 1495
33 UIKit 0x00276a16 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
34 UIKit 0x002768e8 -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 117
35 UIKit 0x00276970 -[UIWindow _setRotatableViewOrientation:duration:force:] + 67
36 UIKit 0x00275a0a __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 120
37 UIKit 0x0027596c -[UIWindow _updateToInterfaceOrientation:duration:force:] + 400
38 UIKit 0x002766c3 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 870
39 UIKit 0x00279c7e -[UIWindow setDelegate:] + 449
40 UIKit 0x0034a037 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 180
41 UIKit 0x0026f91c -[UIWindow addRootViewControllerViewIfPossible] + 609
42 UIKit 0x00270146 -[UIWindow setRootViewController:] + 960
43 UIBarButtonItem Subclass Demo 0x00006a07 -[AKAppDelegate application:didFinishLaunchingWithOptions:] + 823
44 UIKit 0x0022d525 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 309
45 UIKit 0x0022dd65 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1536
46 UIKit 0x00232578 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
47 UIKit 0x0024657c -[UIApplication handleEvent:withNewEvent:] + 3447
48 UIKit 0x00246ae9 -[UIApplication sendEvent:] + 85
49 UIKit 0x002341f5 _UIApplicationHandleEvent + 736
50 GraphicsServices 0x0365a33b _PurpleEventCallback + 776
51 GraphicsServices 0x03659e46 PurpleEventCallback + 46
52 CoreFoundation 0x016b6e95 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
53 CoreFoundation 0x016b6bcb __CFRunLoopDoSource1 + 523
54 CoreFoundation 0x016e18ac __CFRunLoopRun + 2156
55 CoreFoundation 0x016e0bf3 CFRunLoopRunSpecific + 467
56 CoreFoundation 0x016e0a0b CFRunLoopRunInMode + 123
57 UIKit 0x00231cad -[UIApplication _run] + 840
58 UIKit 0x00233f0b UIApplicationMain + 1225
59 UIBarButtonItem Subclass Demo 0x00006e9d main + 141
60 libdyld.dylib 0x01d77725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
After some examination I strangly realized that the setMySubclassedProperty: message is sent to UINavigationButton (which is a private subclass of UIButton used in navigation bars, toolbars and search bars). I set the button in frame 26 and the UIAppearance magic is executed in frame 10.
In iOS 6, the issue exists but a different message is sent to UINavigationButton:
2013-08-13 14:35:58.316 UIBarButtonItem Subclass Demo[1591:c07] -[UINavigationButton _UIAppearance_setMySubclassedProperty:]: unrecognized selector sent to instance 0x810d600
2013-08-13 14:35:58.359 UIBarButtonItem Subclass Demo[1591:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UINavigationButton _UIAppearance_setMySubclassedProperty:]: unrecognized selector sent to instance 0x810d600'
*** First throw call stack:
(0x12b2012 0x10d7e7e 0x133d4bd 0x12a1bbc 0x12a194e 0x12a61bd 0x12a60d6 0x12a624a 0x68b9e8 0x68769c 0x687a95 0x291884 0x3088ca 0x28cf96 0x2934a4 0x28b89d 0x2cc646 0x2bc076 0x2bc517 0x2bcb66 0x2bcab6 0x665e 0x3261c7 0x326232 0x3264da 0x33d8e5 0x33d9cb 0x33dc76 0x33dd71 0x33e89b 0x33e9b9 0x33ea45 0x44420b 0x2952dd 0x10eb6b0 0x289dfc0 0x289233c 0x289deaf 0x3342bd 0x27cb56 0x27b66f 0x27b589 0x27a7e4 0x27a61e 0x27b3d9 0x27e2d2 0x32899c 0x275574 0x275cc1 0x6a07 0x242157 0x242747 0x24394b 0x254cb5 0x255beb 0x247698 0x24b8df9 0x24b8ad0 0x1227bf5 0x1227962 0x1258bb6 0x1257f44 0x1257e1b 0x24317a 0x244ffc 0x6e9d 0x1ab0725)
libc++abi.dylib: terminate called throwing an exception
Deduction
My first thought was: "UIAppearance forwards the setter to AKBarButtonItem and then it crashes". But does it? In an article by Peter Steinberger I found out that Apple is using a special subclass of _UIAppearance for bar items which is called _UIBarItemAppearance. I wanted to confirm that and set a symbolic breakpoint on -[_UIBarItemAppearance forwardInvocation:] and lldb successfully halted just before the exception occurred.
Now it seems to me that Apple is doing some dirty logic in -[_UIBarItemAppearance forwardInvocation:] to realize what selector should be sent to what instance, like:
setBackgroundImage:forState: should be sent to UINavigationButton
setBackButtonBackgroundImage:forState:barMetrics: to UIBarButtonItem
...
And their code looks like this:
if (selector == #selector(setBackButtonBackgroundImage:forState:barMetrics:)) {
// forward to UIBarButtonItem
} else if (selector == #selector(setBackButtonBackgroundVerticalPositionAdjustment:forBarMetrics:)) {
// forward to UIBarButtonItem
} else if (...) {
// more forwarding to UIBarButtonItem
} else {
// forward to UINavigationButton
}
Then, according to my deduction, the last else statement is causing setNiceBarButtonItemAttributes: selector being sent to UINavigationButton, not UIBarButtonItem. If it's true, we're doomed.
Sample code
You can download a sample project here: http://cl.ly/241I2A3U0a0y.
Help
Am I just doing something wrong, or is it a bug? Or maybe Apple did it on purpose? Any help would be appreciated.
The problem is UIBarButtonItem is not a subclass of UIView, it is a "controller" class which creates private UIView subclasses. For bar button items, there is a private appearance proxy which is used, instead of the usual one (some information here).
May I suggest going a different route? Do you really need to subclass bar button items for your customization? Could you not create a subclass of UINavigationBar and use that as your trigger for changes with appearanceWhenContainedIn:?
OK, I ended up using a customView. Seems that it's the only way..
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
i've created an app which loads another viewcontroller from main view controller.example from viewcontroller 1 to viewcontroller2...in viewcontroller1 if button is pressed it needs to load viewcontroller2.and in viewcontroller2 i got icarousel view too..Here is my code
-(IBAction)showcoll:(id)sender{
CollectionsViewController *sec=[[CollectionsViewController alloc]initWithNibName:Nil bundle:Nil];
sec.modalTransitionStyle=UIModalTransitionStyleCrossDissolve;
NSLog(#"hi");
[self presentModalViewController:sec animated:YES];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
CGRect splashFrame =splash.frame;
splashFrame.origin.x = self.view.bounds.size.width;
[UIView animateWithDuration:3
delay:1.0
options: UIViewAnimationCurveEaseOut
animations:^{
splash.frame = splashFrame;
}
completion:^(BOOL finished){
NSLog(#"Done!");
}];
[self.view addSubview: splash];
}
and the issue which i got is
2012-06-30 11:16:29.301 Minora[948:12203] Done!
2012-06-30 11:16:31.195 Minora[948:12203] hi
2012-06-30 11:16:31.198 Minora[948:12203] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIView 0x6e82b70> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key dataSource.'
*** Call stack at first throw:
(
0 CoreFoundation 0x013e45a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x02b97313 objc_exception_throw + 44
2 CoreFoundation 0x013e44e1 -[NSException raise] + 17
3 Foundation 0x00b3b677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x00b3b5e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x003eeff6 -[UIView(CALayerDelegate) setValue:forKey:] + 173
6 UIKit 0x005b730c -[UIRuntimeOutletConnection connect] + 112
7 CoreFoundation 0x0135a8cf -[NSArray makeObjectsPerformSelector:] + 239
8 UIKit 0x005b5d23 -[UINib instantiateWithOwner:options:] + 1041
9 UIKit 0x005b7ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
10 UIKit 0x0046d628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
11 UIKit 0x0046b134 -[UIViewController loadView] + 120
12 UIKit 0x0046b00e -[UIViewController view] + 56
13 UIKit 0x0046ca3d -[UIViewController viewControllerForRotation] + 63
14 UIKit 0x00468988 -[UIViewController _visibleView] + 90
15 UIKit 0x0070a93c -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 354
16 UIKit 0x003e281e -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 954
17 UIKit 0x0066a619 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1381
18 UIKit 0x0046f65d -[UIViewController presentModalViewController:withTransition:] + 3478
19 Minora 0x0000317a -[ViewController showcoll:] + 218
20 UIKit 0x003bb4fd -[UIApplication sendAction:to:from:forEvent:] + 119
21 UIKit 0x0044b799 -[UIControl sendAction:to:forEvent:] + 67
22 UIKit 0x0044dc2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
23 UIKit 0x0044c7d8 -[UIControl touchesEnded:withEvent:] + 458
24 UIKit 0x003dfded -[UIWindow _sendTouchesForEvent:] + 567
25 UIKit 0x003c0c37 -[UIApplication sendEvent:] + 447
26 UIKit 0x003c5f2e _UIApplicationHandleEvent + 7576
27 GraphicsServices 0x01539992 PurpleEventCallback + 1550
28 CoreFoundation 0x013c5944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
29 CoreFoundation 0x01325cf7 __CFRunLoopDoSource1 + 215
30 CoreFoundation 0x01322f83 __CFRunLoopRun + 979
31 CoreFoundation 0x01322840 CFRunLoopRunSpecific + 208
32 CoreFoundation 0x01322761 CFRunLoopRunInMode + 97
33 GraphicsServices 0x015381c4 GSEventRunModal + 217
34 GraphicsServices 0x01538289 GSEventRun + 115
35 UIKit 0x003c9c93 UIApplicationMain + 1160
36 Minora 0x00002ada main + 170
37 Minora 0x00002a25 start + 53
)
terminate called throwing an exception(lldb)
This Sigabart is not happening when you present the modalViewController, but instead it looks like you are setting a UIView to a dataSource in your CollectionsViewController I'm guessing you're doing something wrong in the viewDidLoad, because you never actually see the view yet.
Two questions:
You have not specified a nib name when you created CollectionsViewController. Did you mean to use nil for the nib name?
If you're not using a nib, I'm not sure where your splash view is being created, but I'm curious about your animation of the frame, and then animating the changing of that frame, but adding splash as a subview after you initiate the animation. Was it already on the view (and if so, why adding it again)? If it wasn't, (a) where are you creating it, and (b) why aren't you adding as a subview before the animation?
I have long press gesture in my app and it works good in ios 5.0 but in ios 4.3 i have exception. Here what i see in debug
[UILongPressGestureRecognizer initWithCoder:]: unrecognized selector sent to instance 0x5863360
2012-03-23 23:39:30.384 Woods2[289:ef03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILongPressGestureRecognizer initWithCoder:]: unrecognized selector sent to instance 0x5863360'
*** Call stack at first throw:
(
0 CoreFoundation 0x013415a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01ce6313 objc_exception_throw + 44
2 CoreFoundation 0x013430bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x012b2966 ___forwarding___ + 966
4 CoreFoundation 0x012b2522 _CF_forwarding_prep_0 + 50
5 UIKit 0x005bb9fd UINibDecoderDecodeObjectForValue + 2592
6 UIKit 0x005bb2f5 UINibDecoderDecodeObjectForValue + 792
7 UIKit 0x005bc6ac -[UINibDecoder decodeObjectForKey:] + 398
8 UIKit 0x004d0c54 -[UINib instantiateWithOwner:options:] + 834
9 UIKit 0x004d2ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
10 UIKit 0x00388628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
11 UIKit 0x00386134 -[UIViewController loadView] + 120
12 UIKit 0x0038600e -[UIViewController view] + 56
13 Woods2 0x00004f37 -[FirstViewController viewDidLoad] + 1671
14 UIKit 0x00386089 -[UIViewController view] + 179
15 UIKit 0x00398f54 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 120
16 UIKit 0x00397aaa -[UITabBarController transitionFromViewController:toViewController:] + 64
17 UIKit 0x003998a2 -[UITabBarController _setSelectedViewController:] + 263
18 UIKit 0x00399d5e -[UITabBarController viewWillLayoutSubviews] + 170
19 UIKit 0x004aa2e9 -[UILayoutContainerView layoutSubviews] + 226
20 QuartzCore 0x019faa5a -[CALayer layoutSublayers] + 181
21 QuartzCore 0x019fcddc CALayerLayoutIfNeeded + 220
22 QuartzCore 0x019a20b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
23 QuartzCore 0x019a3294 _ZN2CA11Transaction6commitEv + 292
24 UIKit 0x002d89c9 -[UIApplication _reportAppLaunchFinished] + 39
25 UIKit 0x002d8e83 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 690
26 UIKit 0x002e3617 -[UIApplication handleEvent:withNewEvent:] + 1533
27 UIKit 0x002dbabf -[UIApplication sendEvent:] + 71
28 UIKit 0x002e0f2e _UIApplicationHandleEvent + 7576
29 GraphicsServices 0x015eb992 PurpleEventCallback + 1550
30 CoreFoundation 0x01322944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
31 CoreFoundation 0x01282cf7 __CFRunLoopDoSource1 + 215
32 CoreFoundation 0x0127ff83 __CFRunLoopRun + 979
33 CoreFoundation 0x0127f840 CFRunLoopRunSpecific + 208
34 CoreFoundation 0x0127f761 CFRunLoopRunInMode + 97
35 UIKit 0x002d87d2 -[UIApplication _run] + 623
36 UIKit 0x002e4c93 UIApplicationMain + 1160
37 Woods2 0x00001c2a main + 170
38 Woods2 0x00001b75 start + 53
)
terminate called throwing an exceptionkill
Thank you very much for help
Here is the some code in viewdidload
UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc]
initWithTarget:self action:#selector(handleLongPress:)];
lpgr.minimumPressDuration = 0.2; //user needs to press for 2 seconds
[mapView addGestureRecognizer:lpgr];
[lpgr release];
That trace data is much better formatted now. Now I see it's happening on the loadFromNib, not even when the user performs a long press. And it makes sense especially if the nib was copied in from another project.
Please see if you can find a gesture recognizer in your nib. If it's there, check the connections inspector. It might have some invalid references, possibly to symbols in another project. (You'll probably see a little "!" near one or more of the connections).
If you find that, then problem solved. Delete it, and use the GR you've set up in code. (or re-configure the pointers in the nib and comment out the code in viewDidLoad:).
I've been banging my head against the wall for the past 2 days with it - and I need help.
In my controller, I have this code:
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationController.toolbar.barStyle = UIBarStyleBlack;
[self.navigationController setToolbarHidden:NO];
... // the rest of initialisation goes here
}
This controller presents details of one item selected from the list. Controller displaying a list of items does pushViewControllerAnimated on this controller to display details of the item selected by the user.
This works fine on the first execution, however when the user presses back button - and then selects another (or even the same) item from the list, line [self.navigationController setToolbarHidden:NO] causes SIGABRT with this stack trace:
2011-11-04 10:24:21.423 OOKL[32026:10403] -[NSCFNumber view]: unrecognized selector sent to instance 0x69db0e0
2011-11-04 10:24:21.426 OOKL[32026:10403] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber view]: unrecognized selector sent to instance 0x69db0e0'
*** Call stack at first throw:
(
0 CoreFoundation 0x019875a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01adb313 objc_exception_throw + 44
2 CoreFoundation 0x019890bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x018f8966 ___forwarding___ + 966
4 CoreFoundation 0x018f8522 _CF_forwarding_prep_0 + 50
5 UIKit 0x0063223e -[UIToolbar setItems:animated:] + 1554
6 UIKit 0x005f8ccb -[UIViewController(UINavigationControllerContextualToolbar) setToolbarItems:] + 49
7 OOKL 0x0003df87 -[OOExplorerObjectDetailController setUpToolbarForExplore] + 1335
8 OOKL 0x0003eb2b -[OOExplorerObjectDetailController viewDidLoad] + 2043
9 UIKit 0x005fd089 -[UIViewController view] + 179
10 UIKit 0x005fb482 -[UIViewController contentScrollView] + 42
11 UIKit 0x0060bf25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
12 UIKit 0x0060a555 -[UINavigationController _layoutViewController:] + 43
13 UIKit 0x0060b870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
14 UIKit 0x0060632a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
15 UIKit 0x0060d562 -[UINavigationController pushViewController:transition:forceImmediate:] + 932
16 UIKit 0x006061c4 -[UINavigationController pushViewController:animated:] + 62
17 OOKL 0x0002ed8b -[OOExploreController showObjectDetailControllerWithObject:] + 571
18 OOKL 0x0002da1c -[OOExploreController parserDidFinish:] + 316
19 OOKL 0x00021c13 -[OOXMLParser parserDidEndDocument:] + 99
20 Foundation 0x00385717 _endDocument + 95
21 libxml2.2.dylib 0x02ad4215 xmlParseChunk + 7380
22 Foundation 0x0038615a -[NSXMLParser parse] + 321
23 OOKL 0x00021893 -[OOXMLParser parseString:] + 339
24 OOKL 0x0002d8d5 -[OOExploreController parseXml:] + 165
25 OOKL 0x0002d81f -[OOExploreController requestDidFinishLoading:] + 79
26 OOKL 0x00011cba -[OOSharedSeverController connectionDidFinishLoading:] + 298
27 Foundation 0x002ef112 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 108
28 Foundation 0x002ef06b _NSURLConnectionDidFinishLoading + 133
29 CFNetwork 0x013cd48e _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 220
30 CFNetwork 0x014986e1 _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 293
31 CFNetwork 0x013c3c80 _ZN19URLConnectionClient13processEventsEv + 100
32 CFNetwork 0x013c3acf _ZN17MultiplexerSource7performEv + 251
33 CoreFoundation 0x019688ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
34 CoreFoundation 0x018c688b __CFRunLoopDoSources0 + 571
35 CoreFoundation 0x018c5d86 __CFRunLoopRun + 470
36 CoreFoundation 0x018c5840 CFRunLoopRunSpecific + 208
37 CoreFoundation 0x018c5761 CFRunLoopRunInMode + 97
38 GraphicsServices 0x01e601c4 GSEventRunModal + 217
39 GraphicsServices 0x01e60289 GSEventRun + 115
40 UIKit 0x0055bc93 UIApplicationMain + 1160
41 OOKL 0x00002d09 main + 121
42 OOKL 0x00002c85 start + 53
)
I thought, maybe, I should setup self.toolbarItems first before making the toolbar visible - but then I get this same error when I do
self.toolbarItems = [NSArray ...]
I'm desperate now - any help is appreciated.
Edit: Now for some reason I'm getting EXC_BAD_ACCESS instead of SIGABRT - in the same place - and no stack trace is produced at all.
As the stack trace tells:
-[NSCFNumber view]: unrecognized selector sent to instance 0x69db0e0
You are accidentally overreleasing something that is leading to this message sent to some dangling pointer (reference to some junk).
Check if you are releasing your navigationController, ViewController or anything where your workflow begins.
I have a navigation controller app. I created a RootViewController class with Xib file. In that xib file I had table view and nothing more else. Toolbar and buttons on the toolbar I created in program way. Table view had datasourse and delegate File Owner.
I deleted this xib file, and created a new one with previous name. Created it like viewBased xib file and then I dropped down to it table view, toolbar, two buttons on toolbar. Add outlets on them. Saved it all. Clear all targets. Build all. And Run. Application crashes on start! Anyone know where may be the problem? Thanx!
Stack:
[Session started at 2010-11-16 15:00:52 +0200.]
2010-11-16 15:00:53.729 PhoneBook[16210:207] ******* Accessibility Status Changed: On
2010-11-16 15:00:53.755 PhoneBook[16210:207] ********** Loading AX for: com.yourcompany.PhoneBook ************
2010-11-16 15:00:53.798 PhoneBook[16210:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "RootViewController" nib but the view outlet was not set.'
*** Call stack at first throw:
(
0 CoreFoundation 0x02510b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0266040e objc_exception_throw + 47
2 CoreFoundation 0x024c9238 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x024c91aa +[NSException raise:format:] + 58
4 UIKit 0x0036aa40 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
5 UIKit 0x00368675 -[UIViewController loadView] + 120
6 UIKit 0x004c1c8c -[UITableViewController loadView] + 80
7 UIKit 0x0036854f -[UIViewController view] + 56
8 UIKit 0x003669f4 -[UIViewController contentScrollView] + 42
9 UIKit 0x003767e2 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
10 UIKit 0x00374ea3 -[UINavigationController _layoutViewController:] + 43
11 UIKit 0x0037612d -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
12 UIKit 0x00370ccd -[UINavigationController _startDeferredTransitionIfNeeded] + 266
13 UIKit 0x0048db55 -[UILayoutContainerView layoutSubviews] + 226
14 QuartzCore 0x0456a481 -[CALayer layoutSublayers] + 177
15 QuartzCore 0x0456a1b1 CALayerLayoutIfNeeded + 220
16 QuartzCore 0x045632e0 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 302
17 QuartzCore 0x04563040 _ZN2CA11Transaction6commitEv + 292
18 UIKit 0x002c104e -[UIApplication _reportAppLaunchFinished] + 39
19 UIKit 0x002c1477 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 545
20 UIKit 0x002cb3ec -[UIApplication handleEvent:withNewEvent:] + 1958
21 UIKit 0x002c3b3c -[UIApplication sendEvent:] + 71
22 UIKit 0x002c89bf _UIApplicationHandleEvent + 7672
23 GraphicsServices 0x02d6c822 PurpleEventCallback + 1550
24 CoreFoundation 0x024f1ff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
25 CoreFoundation 0x02452807 __CFRunLoopDoSource1 + 215
26 CoreFoundation 0x0244fa93 __CFRunLoopRun + 979
27 CoreFoundation 0x0244f350 CFRunLoopRunSpecific + 208
28 CoreFoundation 0x0244f271 CFRunLoopRunInMode + 97
29 UIKit 0x002c0c6d -[UIApplication _run] + 625
30 UIKit 0x002ccaf2 UIApplicationMain + 1160
31 PhoneBook 0x00002494 main + 102
32 PhoneBook 0x00002425 start + 53
)
terminate called after throwing an instance of 'NSException'
* Terminating app due to uncaught exception
'NSInternalInconsistencyException',
reason: '-[UIViewController
_loadViewFromNibNamed:bundle:] loaded the "RootViewController" nib but the
view outlet was not set.'
Your view controller lost connection for view outlet, you need to restore it in IB (as you do with all outlets)