Been hunting down an intermittent crash in my app. Finally unlocked the secrets to symbolocating my crash report, and this is what I found:
Incident Identifier: BFCE991E-5F9C-4F04-89AD-A0060EDE73D1
CrashReporter Key: 263d1a93e7ce2d75b397b6ef42b1bc4f29d22f9d
Hardware Model: iPhone2,1
Process: Wine Brain [2787]
Path: /var/mobile/Applications/197DA851-3F8A-486E-8675-74B521A1FD72/Wine Brain.app/Wine Brain
Identifier: Wine Brain
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2010-12-26 19:21:21.551 -0500
OS Version: iPhone OS 4.2.1 (8C148a)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000d
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x3199f464 objc_msgSend + 16
1 Wine Brain 0x0000a0b4 0x1000 + 37044
2 CoreFoundation 0x31436f74 -[NSObject(NSObject) release] + 24
3 libobjc.A.dylib 0x319a0812 objc_setProperty + 114
4 UIKit 0x338f74a0 -[UINavigationController setDisappearingViewController:] + 24
5 UIKit 0x338f7478 -[UINavigationController _clearLastOperation] + 40
6 UIKit 0x338f7394 -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] + 556
7 UIKit 0x338f7128 -[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:] + 204
8 UIKit 0x338f6dee -[UINavigationTransitionView _cleanupTransition] + 450
9 UIKit 0x338f6c18 -[UINavigationTransitionView _navigationTransitionDidStop] + 36
10 UIKit 0x338b4330 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 184
11 UIKit 0x338c0c0e -[UIViewAnimationState animationDidStop:finished:] + 34
12 QuartzCore 0x30a89ea2 run_animation_callbacks(double, void*) + 286
13 QuartzCore 0x30a89d44 CA::timer_callback(__CFRunLoopTimer*, void*) + 116
14 CoreFoundation 0x3148709c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
15 CoreFoundation 0x31486b54 __CFRunLoopDoTimer + 844
16 CoreFoundation 0x314581ae __CFRunLoopRun + 1082
17 CoreFoundation 0x31457c80 CFRunLoopRunSpecific + 224
18 CoreFoundation 0x31457b88 CFRunLoopRunInMode + 52
19 GraphicsServices 0x35d664a4 GSEventRunModal + 108
20 GraphicsServices 0x35d66550 GSEventRun + 56
21 UIKit 0x338d5322 -[UIApplication _run] + 406
22 UIKit 0x338d2e8c UIApplicationMain + 664
23 Wine Brain 0x000021ba 0x1000 + 4538
24 Wine Brain 0x00002184 0x1000 + 4484
As you can see, this is all happening in library code, during an animation for a navigation view controller transition. It seems to happen on a navigate back.
Any ideas on what might cause this that I have control over and what to look for?
Update after some answers
I have this "pattern" whereby I re-use a view controller to show the results of different queries. My code has, say 3 pointers to FetchedResultsController instances, and it has a property currentResults that points to the one being used at the time.
.h file:
#interface MyViewController : UITableViewController <NSFetchedResultsControllerDelegate> {
NSFetchedResultsController *controller1;
NSFetchedResultsController *controller2;
NSFetchedResultsController *controller3;
// and other things unrelated
}
#property (nonatomic, retain) NSFetchedResultsController *currentController;
.m file:
-(void)clearAll {
[controller1 release];
controller1 = nil
[controller2 release];
controller2 = nil
[controller3 release];
controller3 = nil
}
When the caller is going to display my view controller, it firsts configures it for the particulars:
-(void)setupForSearch1 {
self.currentController = [self controller1];
}
- (NSFetchedResultsController *)controller1 {
NSFetchedResultsController *aController = [[[NSFetchedResultsController alloc]
initWithFetchRequest:fetchRequest
managedObjectContext:self.managedObjectContext
sectionNameKeyPath:#"titleFirstLetter"
cacheName:nil] autorelease];
// error handling omitted for brevity
controller1 = [aController retain];
return controller1;
}
So, it's actually hard for me to know for sure if I'm doing the right thing; in setupForSearch1, when I assign to the currentController propertly, I believe a release is done on the old reference. And, I've done a release on it in clearAll. But, since I do have two references to it, this seems OK to me.
I get these kind of errors when I release an object i should not - check your release actions.
It looks like the view controller that is about to go away during this animation is over-released. Check to make sure you're not releasing your view controllers too many times.
Whether the .xib mapped correctly? Check your didSelectRowAtIndexPath: part for any issues if you use tableView.
I recently came across this as I was having the same issue, and this answer did not really help me at all.
What turned out to be the problem was that in the view that was being popped from the UINavigationController, there was a variable for a view that was being set each time.
resultsVC = [[ResultsTableViewController alloc]initWithSearchResults:self.resultsArray];
[self.view addSubview:resultsVC.view];
That view would overwrite the previous one, even if it already existed, and add it to the subView. If the old view still existed, it was creating an orphaned view and causing the crash. the solution was to make sure that if that view existed, to remove it from the superview before re-creating it.
[resultsVC.view removeFromSuperview];
resultsVC = nil;
Hope this helps someone that comes after me! thanks
Related
I'm seeing a strange crash in one of my apps that seems to be coming from a private method on UIAlertView. I've down some searching and found a few other references to this method being involved in crashes such as here, but I'm not convinced that the cause is the same. However to be certain made sure that I always set the UIAlertView delegate to nil whenever the delegate is deallocated.
The stack trace is as follows:
Exception Type: SIGABRT
Exception Codes: #0 at 0x351ce32c
Crashed Thread: 0
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x351ce32c __pthread_kill + 8
1 libsystem_c.dylib 0x370c329f abort + 95
2 eLogbook 0x000bbacd -[GetOperationPartsDictionary init] (GetOperationPartsDictionary.m:22)
3 UIKit 0x32557f93 -[UIAlertView(Private) _popoutAnimationDidStop:finished:] + 855
4 UIKit 0x3240dc53 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 471
5 UIKit 0x3241357d -[UIViewAnimationState animationDidStop:finished:] + 53
6 QuartzCore 0x36eeac2f CA::Layer::run_animation_callbacks(void*) + 203
7 libdispatch.dylib 0x3140ae91 _dispatch_main_queue_callback_4CF$VARIANT$up + 197
8 CoreFoundation 0x353ad2ad __CFRunLoopRun + 1269
9 CoreFoundation 0x353304a5 CFRunLoopRunSpecific + 301
10 CoreFoundation 0x3533036d CFRunLoopRunInMode + 105
11 GraphicsServices 0x3662c439 GSEventRunModal + 137
12 UIKit 0x32426e7d UIApplicationMain + 1081
13 eLogbook 0x0007767f main (main.m:14)
The thing that is really confusing me about this is that the -[UIAlertView(Private) _popoutAnimationDidStop:finished:] method appears to be calling the init method on my GetOperationPartsDictionary class. From the limited amount of information I've had from users this crash is happening on startup, at which point that class would not have been loaded.
I'm using QuincyKit to deliver the crash reports to a server, from there they're symbolicated using the standard symbolicatecrash script. The version of Xcode being used to symbolicate the crash is the same version that was used to build the binary, and I'm confident that the dSYM used to symbolicate the crash is the correct one - the line numbers for my code are correct for example.
Anyone have any thoughts on this?
Edit: should have added that this is occurring in the field with a live app, but only occasionally. It has affected maybe 1 or 2 users in a thousand or so, but I have never been able to reproduce it either on a device or in the simulator.
Looks like you have called the UIAlertViewDelegate after the alertview has been released.
Release it only in the dealloc method like this :
-(void)dealloc {
self.alertView.delegate = nil; //setting delegate to nil
self.alertView = nil; //if you have defined alert as property
//other release statements of your controller
[super dealloc];
}
I am using AdWhirl in my iphone app and I am displaying the adView in several different views. Each view has a different adView ivar. Problem is that when I am switching the views quickly, ASIHttpRequest within Adwhirl code tries to call the view after the view has been deallocted. I have tried setting the delegate to nil in my view but to no avail. Are there any other workarounds to cancel the AdWhirl ASIHttpRequest when the view is deallocated. In my view dealloc I am doing something like:
adView.delegate = nil;
adView = nil
where adView is an ivar declared like:
#property (nonatomic, retain) AdWhirlView *adView;
Crash Log:
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000c
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x32ad5c98 objc_msgSend + 16
1 SocialMashup 0x0005503c -[ASIHTTPRequest requestReceivedResponseHeaders:] (ASIHTTPRequest.m:1954)
2 CoreFoundation 0x36387efc -[NSObject(NSObject) performSelector:withObject:] + 16
3 Foundation 0x32cfe7a2 __NSThreadPerformPerform + 262
4 CoreFoundation 0x363f1a72 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
5 CoreFoundation 0x363f3758 __CFRunLoopDoSources0 + 376
6 CoreFoundation 0x363f44e4 __CFRunLoopRun + 224
7 CoreFoundation 0x36384ebc CFRunLoopRunSpecific + 224
8 CoreFoundation 0x36384dc4 CFRunLoopRunInMode + 52
9 GraphicsServices 0x30cdd418 GSEventRunModal + 108
10 GraphicsServices 0x30cdd4c4 GSEventRun + 56
11 UIKit 0x3037cd62 -[UIApplication _run] + 398
12 UIKit 0x3037a800 UIApplicationMain + 664
13 ZFirewall.dylib 0x013dcb24 0x13cd000 + 64292
14 SocialMashup 0x000024ae main (main.m:17)
15 SocialMashup 0x00002444 start + 32
I'm pretty sure AdWhirl doesn't use ASIHTTPRequest at all. Maybe a particular ad network you're using does, but the logs don't even seem to point to AdWhirl as the culprit.
My app works great when I build and debug but when I run on its own, it crashes due to some other issues.
I have one NSObject class, one UITableView class, one UIView class , one UITableViewCell class and one NSOperation class.
Does any body have similar issues or if any one can help me out.
Application Specific Information:
objc_msgSend() selector name: release
iPhone Simulator 235, iPhone OS 4.2 (iPhone/8C134)
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x01134a67 objc_msgSend + 27
1 UIKit 0x004ab1e2 -[UITableViewCell removeFromSuperview] + 167
2 UIKit 0x003249d9 -[UIView dealloc] + 340
3 UIKit 0x0032e281 -[UIScrollView dealloc] + 341
4 UIKit 0x003661ce -[UITableView dealloc] + 1085
5 Foundation 0x000698da __delayedPerformCleanup + 59
6 CoreFoundation 0x00f4bbde CFRunLoopTimerInvalidate + 446
7 CoreFoundation 0x00fb57d7 __CFRunLoopDoTimer + 1799
8 CoreFoundation 0x00f11cc9 __CFRunLoopRun + 1817
9 CoreFoundation 0x00f11240 CFRunLoopRunSpecific + 208
10 CoreFoundation 0x00f11161 CFRunLoopRunInMode + 97
11 GraphicsServices 0x01874268 GSEventRunModal + 217
12 GraphicsServices 0x0187432d GSEventRun + 115
13 UIKit 0x002fa42e UIApplicationMain + 1160
14 Time 0x00001e08 main + 102 (main.m:14)
15 Time 0x00001d99 start + 53
This technote has the technical info on crashlogs:
http://developer.apple.com/library/mac/#technotes/tn2004/tn2123.html
However, you are having a debugging problem, not a crashlog problem.
See tips for debugging here:
http://www.cocoadev.com/index.pl?DebuggingTechniques
Interpreting crash logs takes practice. People here see this: removeFromSuperview and immediately think "Aha, a clue! this is likely a memory issue" because removeFromSuperview will remove a view then decrement it's retain count. if the retain count is already zero, then decrementing one more time may lead to a crash. Thus, they think you are over releasing your UITableViewCell
check your UITableViewCell for alloc/init, release or autorelease...
My app crashes on iPad simulator in alternate builds, crash then run then crash, etc.
objc[1116]: Class Protocol is implemented in both /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libobjc.A.dylib and /Users/NGA24iMAC3/Library/Application Support/iPhone Simulator/4.2/Applications/C0FFA7D7-7684-4854-B641-62BD11CFD226/Innovations.app/Innovations. One of the two will be used. Which one is undefined.
2011-02-09 11:53:01.446 Innovations[1116:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "PadLoginScreen" nib but the view outlet was not set.'
*** Call stack at first throw:
(
0 CoreFoundation 0x01286be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x013db5c2 objc_exception_throw + 47
2 CoreFoundation 0x0123f628 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x0123f59a +[NSException raise:format:] + 58
4 UIKit 0x004a2b75 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
5 UIKit 0x004a0709 -[UIViewController loadView] + 120
6 UIKit 0x004a05e3 -[UIViewController view] + 56
7 UIKit 0x0049ea57 -[UIViewController contentScrollView] + 42
8 UIKit 0x004af201 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
9 UIKit 0x004ad831 -[UINavigationController _layoutViewController:] + 43
10 UIKit 0x004aeb4c -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
11 UIKit 0x004a9606 -[UINavigationController _startDeferredTransitionIfNeeded] + 266
12 UIKit 0x004b083e -[UINavigationController pushViewController:transition:forceImmediate:] + 932
13 UIKit 0x004a94a0 -[UINavigationController pushViewController:animated:] + 62
14 Innovations 0x00006172 -[SplashScreenController switchView] + 303
15 Foundation 0x001887a5 __NSFireTimer + 125
16 CoreFoundation 0x01267fe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
17 CoreFoundation 0x01269594 __CFRunLoopDoTimer + 1220
18 CoreFoundation 0x011c5cc9 __CFRunLoopRun + 1817
19 CoreFoundation 0x011c5240 CFRunLoopRunSpecific + 208
20 CoreFoundation 0x011c5161 CFRunLoopRunInMode + 97
21 GraphicsServices 0x01b52268 GSEventRunModal + 217
22 GraphicsServices 0x01b5232d GSEventRun + 115
23 UIKit 0x0040142e UIApplicationMain + 1160
24 Innovations 0x00002e70 main + 102
25 Innovations 0x00002e01 start + 53
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
But all outlet set correctly in IB.Please help me.Thanx in advance.
#Ishu i think that something is wrong with your connections in IB.I know you checked your IB but can you make your .xib file once again.
I suggest cleaning your project. Command + Shift + K
Next, open your XIB file and verify that the view outlet of the "File's Owner" is connected to your view. Of not connect and it and save.
Rebuild your project.
I also faced same problem in my Universal app .
I did something like this that solved my problem -
- (id)initWithNibName:(NSString *)n bundle:(NSBundle *)b
{
return [self init];
}
- (id)init
{
BOOL iPad = NO;
#ifdef UI_USER_INTERFACE_IDIOM
iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
#endif
if (iPad)
{
// iPad specific code here
NSLog(#"Device is iPad");
[super initWithNibName:#"ContactUsViewController~ipad" bundle:nil];
} else
{
// iPhone/iPod specific code here
NSLog(#"Device is iPhone");
[super initWithNibName:#"ContactUsViewController" bundle:nil];
}
return self;
}
when you are adding/pushing viewController just call its init method and then push viewcontroller.
Open our iPad xib in Interface Builder
Click on File's ownner
In the Inspector, go to the fourth tab (Identity)
Write as class identity the name of the class that is acting as view controller for that xib.
Ready to go!
I've spent that last two hours starring at the most cookie cutter block of code and I can't figure out why it's crashing, plus there's no error message or any useful data shown in the console or debugger. I'm simply trying to load a view controller that inherits from UITableViewController and its only instance var is a UITableView object. Here's the class code...
#interface PlayFriendViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource>
{
IBOutlet UITableView *rootTableView;
}
#property (nonatomic, retain) IBOutlet UITableView *rootTableView;
#end
Here's the code that loads it and pushes it on to the stack....
PlayFriendViewController *pfvc = [[PlayFriendViewController alloc] initWithNibName:#"PlayFriendView_iPhone" bundle:nil];
[self.navigationController pushViewController:pfvc animated:YES]; //<--Crashes here
[pfvc release];
and here's the relevant part of the callstack....
0 libSystem.B.dylib 0x33bd52d4 __kill + 8
1 libSystem.B.dylib 0x33bd52c4 kill + 4
2 libSystem.B.dylib 0x33bd52b6 raise + 10
3 libSystem.B.dylib 0x33be9d72 abort + 50
4 libstdc++.6.dylib 0x31bdba20 __gnu_cxx::__verbose_terminate_handler() + 376
5 libobjc.A.dylib 0x3347c594 _objc_terminate + 104
6 libstdc++.6.dylib 0x31bd9df2 __cxxabiv1::__terminate(void (*)()) + 46
7 libstdc++.6.dylib 0x31bd9e46 std::terminate() + 10
8 libstdc++.6.dylib 0x31bd9f16 __cxa_throw + 78
9 libobjc.A.dylib 0x3347b4c4 objc_exception_throw + 64
10 CoreFoundation 0x33ac07c2 +[NSException raise:format:arguments:] + 62
11 CoreFoundation 0x33ac07fc +[NSException raise:format:] + 28
12 UIKit 0x320e4118 -[UITableViewController loadView] + 188
13 UIKit 0x320a0220 -[UIViewController view] + 24
14 UIKit 0x320acd04 -[UIViewController contentScrollView] + 16
15 UIKit 0x320acb74 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 24
16 UIKit 0x320aca72 -[UINavigationController _layoutViewController:] + 18
17 UIKit 0x320ac54a -[UINavigationController _startTransition:fromViewController:toViewController:] + 374
18 UIKit 0x320ac358 -[UINavigationController _startDeferredTransitionIfNeeded] + 176
19 UIKit 0x320a00be -[UINavigationController pushViewController:transition:forceImmediate:] + 634
20 UIKit 0x3209fe34 -[UINavigationController pushViewController:animated:] + 28
One thing to note: When I remove the UITableView instance var and all connections to it, the view loads successfully. There's nothing in the view, but at least it doesn't crash.
Any ideas what's happening or how I can get further information on this crash?
Thanks so much for your wisdom!
Are you #synthesizing rootTableView?
There should be an exception logged to the console, but if it somehow doesn't reach it, try putting the crashing line in a #try {} #catch () {} block, print the exception and then terminate (or not).
Fixed the problem and, like all really puzzling bugs, it was stupid. I guess I don't feel so bad since no one else caught it either, but my view controller should be a subclass of UIViewController, not UITableViewController, since a UITableView object is an instance var of my class and my view controller adheres to the appropriate protocols. Anyhow, fixed it, now it works. That stupid mistake only took me two hours to fix...ugghh.
The failure occurs when the new viewController is attempting to load the view, which implies that there's some kind of problem with the .xib or, more likely, connections to the .xib.
I would guess that your UITableView in the .xib is pointing to an invalid delegate or dataSource, or even more likely, the outlet is pointing to something that doesn't exist. Perhaps you changed the name of the tableView outlet or of the viewController.