View controller uses one nib fine but crashes with another - ios

I'm working on a universal app and the iPhone version works just fine. I created a new nib for iPad and set the files owner to be the viewcontroller class. The I connected all the IBOutlets and IBActions. When I run the app on an iPad (and in the iPad simulator) it crashes when I touch any of the controls. I tried setting break points in the IBActions for each but it doesn't even make it to those before the crash happens. What's going on?
Backtrace:
* thread #1: tid = 0x1f03, 0x0189809b libobjc.A.dylibobjc_msgSend + 15, stop reason = EXC_BAD_ACCESS (code=2, address=0x15)
frame #0: 0x0189809b libobjc.A.dylibobjc_msgSend + 15
frame #1: 0x0020f14e UIKit-[UIApplication sendAction:to:from:forEvent:] + 96
frame #2: 0x0020f0e6 UIKit-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
frame #3: 0x002b5ade UIKit-[UIControl sendAction:to:forEvent:] + 66
frame #4: 0x002b5fa7 UIKit-[UIControl(Internal) _sendActionsForEvents:withEvent:] + 503
frame #5: 0x002b5b13 UIKit-[UIControl sendActionsForControlEvents:] + 48
frame #6: 0x00304462 UIKit-[UISegmentedControl _setSelectedSegmentIndex:notify:] + 684
frame #7: 0x00305dd0 UIKit-[UISegmentedControl touchesBegan:withEvent:] + 1026
frame #8: 0x002342cf UIKit-[UIWindow sendTouchesForEvent:] + 272
frame #9: 0x002345e6 UIKit-[UIWindow sendEvent:] + 273
frame #10: 0x0021adc4 UIKit-[UIApplication sendEvent:] + 464
frame #11: 0x0020e634 UIKit_UIApplicationHandleEvent + 8196
frame #12: 0x021c0ef5 GraphicsServicesPurpleEventCallback + 1274
frame #13: 0x012a1195 CoreFoundation__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
frame #14: 0x01205ff2 CoreFoundation_CFRunLoopDoSource1 + 146
frame #15: 0x012048da CoreFoundation__CFRunLoopRun + 2218
frame #16: 0x01203d84 CoreFoundationCFRunLoopRunSpecific + 212
frame #17: 0x01203c9b CoreFoundationCFRunLoopRunInMode + 123
frame #18: 0x021bf7d8 GraphicsServicesGSEventRunModal + 190
frame #19: 0x021bf88a GraphicsServicesGSEventRun + 103
frame #20: 0x0020c626 UIKitUIApplicationMain + 1163
frame #21: 0x00001d8d gravity`main + 141 at main.m:16

Turns out the view controller wasn't being retained due to ARC. So when I went back to send messages to it it crashed.

Related

Navigation to Different view results in SIGABRT error

I am new to Objective C, and cannot figure out the error I am facing right now. The app was developed by some other developer few years back, and I just have to change some images and upload back as new version (and underline API/webservice got updated). Everything was done fine, but one button in app is causing a crash.
We have two button in our main interface, one shows the listing near by user location, which works, and we have another to show all listing. The calling method for them is same, but when we use Show all listing interface in code it crash application with no error. in Debugger it shows (lldb) and generate SIGABRT in main appdelegate call.
Here is the button code
-(IBAction)btnAllResturantAction:(id)sender
{
[btnAllRestaruant setImage:[UIImage imageNamed:#"all_restaurants_tapped.png"] forState:UIControlStateNormal];
NSLog(#"SearchView : Button CLick for All Resturant");
#try {
HomeViewController *homeView1=[[HomeViewController alloc]initWithNibName:#"HomeViewController" bundle:nil];
[self.navigationController pushViewController:homeView1 animated:YES];
NSLog(#"SearchView: Button CLick complete");
} #catch (NSException *exception){
NSLog(#"Search View: Exception in All Resturant %#", exception.reason);
}
}
When in line by line debug, I can see Log message of "Button Click complete" visible in debugger window, but just after that it fail and crash application, I didn't see any other error message even after I try bt in Debugger window, it shows all framework code. Here is bt result anyways
* thread #1: tid = 0x129d3, 0x0464e62a libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x0464e62a libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x04617664 libsystem_pthread.dylib`pthread_kill + 101
frame #2: 0x043c539d libsystem_c.dylib`abort + 156
frame #3: 0x002ff065 project6`uncaught_exception_handler + 38
frame #4: 0x03eabebe CoreFoundation`__handleUncaughtException + 830
frame #5: 0x0396d0ae libobjc.A.dylib`_objc_terminate() + 100
frame #6: 0x04687d0d libc++abi.dylib`std::__terminate(void (*)()) + 14
frame #7: 0x0468793e libc++abi.dylib`__cxa_rethrow + 103
frame #8: 0x0396cfad libobjc.A.dylib`objc_exception_rethrow + 47
frame #9: 0x03dba7d0 CoreFoundation`CFRunLoopRunSpecific + 672
frame #10: 0x03dba51b CoreFoundation`CFRunLoopRunInMode + 123
frame #11: 0x056ef664 GraphicsServices`GSEventRunModal + 192
frame #12: 0x056ef4a1 GraphicsServices`GSEventRun + 104
frame #13: 0x006941eb UIKit`UIApplicationMain + 160
frame #14: 0x000abf7a project6`main(argc=1, argv=0xbff5587c) + 138 at main.m:14
frame #15: 0x0431ea21 libdyld.dylib`start + 1
Can you guide me where and how I look for error, with this information.
EDIT:
I add Exception Breakpoint which generate this bt
(lldb) bt
thread #1: tid = 0x1368d, 0x03996dd0 libobjc.A.dylib`objc_exception_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1
frame #0: 0x03996dd0 libobjc.A.dylib`objc_exception_throw
frame #1: 0x03ed59ad CoreFoundation`+[NSException raise:format:] + 141
frame #2: 0x008873cb UIKit`-[UIViewController _loadViewFromNibNamed:bundle:] + 740
frame #3: 0x00887ccc UIKit`-[UIViewController loadView] + 189
frame #4: 0x008880d8 UIKit`-[UIViewController loadViewIfRequired] + 154
frame #5: 0x0088ebde UIKit`-[UIViewController __viewWillAppear:] + 114
frame #6: 0x008b1d37 UIKit`-[UIViewController(UIContainerViewControllerProtectedMethods) beginAppearanceTransition:animated:] + 202
frame #7: 0x008c4009 UIKit`-[UINavigationController _startCustomTransition:] + 1389
frame #8: 0x008d5bf5 UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 803
frame #9: 0x008d6e3b UIKit`-[UINavigationController __viewWillLayoutSubviews] + 68
frame #10: 0x00ab2193 UIKit`-[UILayoutContainerView layoutSubviews] + 252
frame #11: 0x00787eb7 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 813
frame #12: 0x039ab059 libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
frame #13: 0x0586780a QuartzCore`-[CALayer layoutSublayers] + 144
frame #14: 0x0585b4ee QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 388
frame #15: 0x0585b352 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
frame #16: 0x0584de8b QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 317
frame #17: 0x05881e03 QuartzCore`CA::Transaction::commit() + 561
frame #18: 0x05883674 QuartzCore`CA::Transaction::flush_transaction() + 50
frame #19: 0x006b7f0a UIKit`_UIApplicationHandleEventQueue + 8398
frame #20: 0x03defd1f CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
frame #21: 0x03de59ab CoreFoundation`__CFRunLoopDoSources0 + 523
frame #22: 0x03de4dc8 CoreFoundation`__CFRunLoopRun + 1032
frame #23: 0x03de4706 CoreFoundation`CFRunLoopRunSpecific + 470
frame #24: 0x03de451b CoreFoundation`CFRunLoopRunInMode + 123
frame #25: 0x05719664 GraphicsServices`GSEventRunModal + 192
frame #26: 0x057194a1 GraphicsServices`GSEventRun + 104
frame #27: 0x006be1eb UIKit`UIApplicationMain + 160
frame #28: 0x000d5f7a project6`main(argc=1, argv=0xbff2b87c) + 138 at main.m:14
frame #29: 0x04348a21 libdyld.dylib`start + 1

Crash with localDataStore and PFFacebookUtils

I just enabled localDataStore. Everything worked fine before, and if I comment it out everything works fine again. I want to do some local persistence, and since I can't use NSCoding for PFRelations to store objects in NSUserDefaults, my best option is localDataStore.
But it's not working.
If I login with Facebook it works fine. However, on the next app launch it crashes on this line:
[PFFacebookUtils initializeFacebook];
With the console:
-[__NSCFBoolean _loadSensitiveUserDataFromKeychainItemWithName:]: unrecognized selector sent to instance 0x37f77660
And the trace:
* thread #1: tid = 0xf318, 0x3762cc64 libobjc.A.dylib`objc_exception_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x3762cc64 libobjc.A.dylib`objc_exception_throw
frame #1: 0x29e2a038 CoreFoundation`-[NSObject(NSObject) doesNotRecognizeSelector:] + 188
frame #2: 0x29e27f56 CoreFoundation`___forwarding___ + 714
frame #3: 0x29d59df8 CoreFoundation`_CF_forwarding_prep_0 + 24
frame #4: 0x00697a4c LY`+[PFUser currentUser](self=<unavailable>, _cmd=<unavailable>) + 532 at PFUser.m:928
frame #5: 0x00693d14 LY`+[PFUser(self=<unavailable>, _cmd=<unavailable>, provider=0x15d55fb0) registerAuthenticationProvider:] + 116 at PFUser.m:423
* frame #6: 0x007a5f46 LY`+[PFFacebookUtils initializeFacebookWithUrlShemeSuffix:](self=<unavailable>, _cmd=<unavailable>, urlSchemeSuffix=<unavailable>) + 98 at PFFacebookUtils.m:58
frame #7: 0x000a6f96 LY`-[AppDelegate application:didFinishLaunchingWithOptions:](self=0x15de8260, _cmd=0x2da83320, application=0x15de5420, launchOptions=0x00000000) + 1190 at AppDelegate.m:139
frame #8: 0x2d34e720 UIKit`-[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 284
frame #9: 0x2d5435ae UIKit`-[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2358
frame #10: 0x2d545afa UIKit`-[UIApplication _runWithMainScene:transitionContext:completion:] + 1374
frame #11: 0x2d550378 UIKit`__84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 36
frame #12: 0x2d544386 UIKit`-[UIApplication workspaceDidEndTransaction:] + 130
frame #13: 0x3056b0e8 FrontBoardServices`__31-[FBSSerialQueue performAsync:]_block_invoke + 12
frame #14: 0x29deb39c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
frame #15: 0x29dea660 CoreFoundation`__CFRunLoopDoBlocks + 216
frame #16: 0x29de8de2 CoreFoundation`__CFRunLoopRun + 762
frame #17: 0x29d37210 CoreFoundation`CFRunLoopRunSpecific + 476
frame #18: 0x29d37022 CoreFoundation`CFRunLoopRunInMode + 106
frame #19: 0x2d3483ee UIKit`-[UIApplication _run] + 558
frame #20: 0x2d3431d0 UIKit`UIApplicationMain + 1440
frame #21: 0x001310d4 LY`main(argc=1, argv=0x015a3ad0) + 116 at main.m:9
So, this "feature" seems to be resolved with the update to v1.6.3 of the Parse iOS/OS X SDK.
See this link provided by #Numereyes for the discussion and the official response...

UICollectionView crash on scroll

I tried to create a UICollectionView using the Flow Layout.
The cells are simply text labels for the time being.
The first screen of cells is displayed just fine, but when I try to scroll, the simulator crashes.
The debugger shows the following messages:
(lldb) thread backtrace
* thread #1: tid = 0x39235a, 0x008440b2 libobjc.A.dylib`objc_msgSend + 14, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xa000000c)
* frame #0: 0x008440b2 libobjc.A.dylib`objc_msgSend + 14
frame #1: 0x01ab9b30 UIKit`-[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 257
frame #2: 0x01abb775 UIKit`-[UICollectionView _updateVisibleCellsNow:] + 4730
frame #3: 0x01abf65f UIKit`-[UICollectionView layoutSubviews] + 265
frame #4: 0x014e2964 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
frame #5: 0x0084682b libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
frame #6: 0x0280e45a QuartzCore`-[CALayer layoutSublayers] + 148
frame #7: 0x02802244 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 380
frame #8: 0x028020b0 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
frame #9: 0x027687fa QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 294
frame #10: 0x02769b85 QuartzCore`CA::Transaction::commit() + 393
frame #11: 0x0276a258 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
frame #12: 0x02bd936e CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
frame #13: 0x02bd92bf CoreFoundation`__CFRunLoopDoObservers + 399
frame #14: 0x02bb7254 CoreFoundation`__CFRunLoopRun + 1076
frame #15: 0x02bb69d3 CoreFoundation`CFRunLoopRunSpecific + 467
frame #16: 0x02bb67eb CoreFoundation`CFRunLoopRunInMode + 123
frame #17: 0x05f5b5ee GraphicsServices`GSEventRunModal + 192
frame #18: 0x05f5b42b GraphicsServices`GSEventRun + 104
frame #19: 0x01473f9b UIKit`UIApplicationMain + 1225
frame #20: 0x0002423c 8actions`main(argc=1, argv=0xbfffe610) + 156 at main.mm:15
I am using the latest version of rubymotion and the IOS Simulator set to iPhone 4 Inch with IOS 7.1.
The code I am using can be found here:
https://gist.github.com/jhmegorei/42c15038a34971ac5e8e
Note: I did not want to use a CollectionViewController, as I require the collection View to be just another view element that can be added to a normal UIView.
I would be glad if there is anyone who could help me investigate the root cause of this crash :)
There is no "MemoListViewDelegate.rb" in the gist. Did you mean "MemoListDataSource.rb" ?
Also, I assume you mean you changed
list_view.dataSource = MemoListDatasource.new
to
list_view.dataSource = self
as well as moving the data source methods in there.
Did you make any other changes to get it to work?

App crashes on launch on iOS 6 but working fine on iOS 7

I developed an app in Xcode 5. Until now I only tested it on a device running iOS 7. I tried running it on another device with iOS 6 but it crashes on launch in the main function without any error message in the console. The deployment target is 6.0 and I've chosen Standard architectures(armv7, armv7s) in the Build Settings.
I also checked the code for methods available only for iOS 7. Could it be that I accidentally skipped one? As for as I know I should get an error message if it doesn't recognise the method.
I'm not a newbie on iOS development, but something is skipping my attention. Do you have any idea what it could be?
I would really appreciate your help. Thank you.
UPDATE:
This is it... Could it be something in the plist...?
I finally got to the bottom of this problem thanks to "OC Rickard". Writing 'bt' in the console, this was the output:
thread #1: tid = 0x2503, 0x38a8b454 CoreFoundationCFDictionaryRemoveValue + 12, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x38a8b454 CoreFoundationCFDictionaryRemoveValue + 12
frame #1: 0x36e58e28 GraphicsServicesRemoveFont + 740
frame #2: 0x36e58868 GraphicsServicesAddFontsFromCGFontAndPath + 332
frame #3: 0x36e58660 GraphicsServicesAddFontsFromURLOrPath + 156
frame #4: 0x36e59e12 GraphicsServicesInitialize_block_invoke_0 + 378
frame #5: 0x36e3a4b6 libdispatch.dylib_dispatch_client_callout + 22
frame #6: 0x36e403f6 libdispatch.dylibdispatch_once_f$VARIANT$mp + 42
frame #7: 0x36e57f7a GraphicsServicesInitialize + 78
frame #8: 0x36e57fc0 GraphicsServicesGSFontCreateWithName + 56
frame #9: 0x31c7cfea UIKitUINewFont + 58
frame #10: 0x31c7cf9a UIKit+[UIFont systemFontOfSize:traits:] + 18
frame #11: 0x31fa608c UIKit-[UIStatusBarServiceItemView _contentsImageFromString:withWidth:letterSpacing:forStyle:] + 124
frame #12: 0x31cd888a UIKit-[UIStatusBarServiceItemView _serviceContentsImageForStyle:] + 362
frame #13: 0x31cd84ac UIKit-[UIStatusBarServiceItemView updateContentsAndWidth] + 140
frame #14: 0x31cd823e UIKit-[UIStatusBarItemView initWithItem:data:actions:style:] + 306
frame #15: 0x31cd7f90 UIKit-[UIStatusBarLayoutManager _createViewForItem:withData:actions:] + 108
frame #16: 0x31c877de UIKit-[UIStatusBarLayoutManager _prepareEnabledItemType:withEnabledItems:withData:actions:itemAppearing:itemDisappearing:] + 134
frame #17: 0x31c8770e UIKit-[UIStatusBarLayoutManager prepareEnabledItems:withData:actions:] + 82
frame #18: 0x31f9e910 UIKit-[UIStatusBarForegroundView _setStatusBarData:actions:animated:] + 168
frame #19: 0x31c87662 UIKit-[UIStatusBarForegroundView setStatusBarData:actions:animated:] + 722
frame #20: 0x31cd7516 UIKit-[UIStatusBar _prepareToSetStyle:animation:] + 794
frame #21: 0x31c8978e UIKit-[UIStatusBar requestStyle:animationParameters:] + 558
frame #22: 0x31c894a8 UIKit-[UIStatusBar requestStyle:animated:] + 84
frame #23: 0x31cd2f6e UIKit-[UIApplication _createStatusBarWithRequestedStyle:orientation:hidden:] + 258
frame #24: 0x31cd2736 UIKit-[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 430
frame #25: 0x31c7ac38 UIKit-[UIApplication handleEvent:withNewEvent:] + 1004
frame #26: 0x31c7a6cc UIKit-[UIApplication sendEvent:] + 72
frame #27: 0x31c7a11a UIKit_UIApplicationHandleEvent + 6154
frame #28: 0x36e5d5a2 GraphicsServices_PurpleEventCallback + 590
frame #29: 0x36e5d1d2 GraphicsServicesPurpleEventCallback + 34
frame #30: 0x38b1d172 CoreFoundation__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 34
frame #31: 0x38b1d116 CoreFoundation__CFRunLoopDoSource1 + 138
frame #32: 0x38b1bf98 CoreFoundation__CFRunLoopRun + 1384
frame #33: 0x38a8eebc CoreFoundationCFRunLoopRunSpecific + 356
frame #34: 0x38a8ed48 CoreFoundationCFRunLoopRunInMode + 104
frame #35: 0x31cd147c UIKit-[UIApplication _run] + 668
frame #36: 0x31cce2f8 UIKitUIApplicationMain + 1120
frame #37: 0x00085f96 iSpyLovemain(argc=1, argv=0x2fd98d20) + 110 at main.m:16
frame #38: 0x362fab20 libdyld.dylibstart + 4
I had a font declared in the plist file which had .dfont extension. Apparently iOS 6 didn't like this. Thank you "OC Rickard", and thanks to all of you guys for taking interest in my problem.

[UIView _forgetDependentConstraint:]: message sent to deallocated instance

I tried using NSZobie and all others. Still i face issues. can't able to find where app crashed. Please Help. thanks in advance.
*** -[UIView _forgetDependentConstraint:]: message sent to deallocated instance 0x208e0010
(lldb) bt
* thread #1: tid = 0x2503, 0x342b3468 CoreFoundation`___forwarding___ + 192, stop reason = EXC_BREAKPOINT (code=EXC_ARM_B`enter code here`REAKPOINT, subcode=0xdefe)
frame #0: 0x342b3468 CoreFoundation`___forwarding___ + 192
frame #1: 0x3420af68 CoreFoundation`__forwarding_prep_0___ + 24
frame #2: 0x364f24ba UIKit`_updateViewDependenciesForConstraint + 202
frame #3: 0x364f9a2c UIKit`__72-[UIView(AdditionalLayoutSupport) _removeRelevantConstraintsFromEngine:]_block_invoke_0 + 264
frame #4: 0x34c65882 Foundation`-[NSISEngine withAutomaticOptimizationDisabled:] + 166
frame #5: 0x364f98ee UIKit`-[UIView(AdditionalLayoutSupport) _removeRelevantConstraintsFromEngine:] + 94
frame #6: 0x3629f4a0 UIKit`__UIViewWillBeRemovedFromSuperview + 588
frame #7: 0x360e7848 UIKit`-[UIView(Hierarchy) removeFromSuperview] + 56
frame #8: 0x36137f18 UIKit`-[UINavigationTransitionView _cleanupTransition] + 92
frame #9: 0x360ceab2 UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 158
frame #10: 0x361438ee UIKit`-[UIViewAnimationState animationDidStop:finished:] + 50
frame #11: 0x35e78c00 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 208
frame #12: 0x3c3f04b6 libdispatch.dylib`_dispatch_client_callout + 22
frame #13: 0x3c3f51bc libdispatch.dylib`_dispatch_main_queue_callback_4CF$VARIANT$mp + 224
frame #14: 0x34284f3a CoreFoundation`__CFRunLoopRun + 1290
frame #15: 0x341f7ebc CoreFoundation`CFRunLoopRunSpecific + 356
frame #16: 0x341f7d48 CoreFoundation`CFRunLoopRunInMode + 104
frame #17: 0x37dd02ea GraphicsServices`GSEventRunModal + 74
frame #18: 0x3610d300 UIKit`UIApplicationMain + 1120
frame #19: 0x000521de MyApp®`main(argc=1, argv=0x2fdb3cf8) + 162 at main.m:6
frame #20: 0x3c410b20 libdyld.dylib`start + 4
Check if you have UIAlertView or animations in view before came back to your view. It seems you are initalize a view with it's local variable, wihout having express use self delegate, or you use removeFromSuperview for a view while actions still call it after remove.

Resources