I have a strage crash scenario to crash the app!
When you do a fresh install by running the app from Xcode; the application will run perfectly.
But I installed by current app from app store, then run the application, now everything is perfect till you click on home button, the application will crash at that moment! What's the problem? And How could I solve it?
UPDATED (This is the log):
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x6f687370
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 ??? 0x6f687370 0 + 1869116272
1 CoreFoundation 0x291ad93c _CFXNotificationPost + 1784
2 Foundation 0x29edd9b8 -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
3 UIKit 0x2c99b7ae -[UIApplication _handleApplicationDectivationWithScene:shouldForceExit:transitionContext:completion:] + 882
4 UIKit 0x2c9a29f0 __88-[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:]_block_invoke + 76
5 UIKit 0x2c9a299c -[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:] + 360
6 UIKit 0x2c997c82 -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 478
7 FrontBoardServices 0x2f9a21f8 __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke_2 + 40
8 FrontBoardServices 0x2f9b10e8 __31-[FBSSerialQueue performAsync:]_block_invoke + 12
9 CoreFoundation 0x2925f5b4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
10 CoreFoundation 0x2925e878 __CFRunLoopDoBlocks + 216
11 CoreFoundation 0x2925d3b2 __CFRunLoopRun + 1714
12 CoreFoundation 0x291ab620 CFRunLoopRunSpecific + 476
13 CoreFoundation 0x291ab432 CFRunLoopRunInMode + 106
14 GraphicsServices 0x305310a8 GSEventRunModal + 136
15 UIKit 0x2c796358 UIApplicationMain + 1440
16 MyNiceTestApp 0x000cae9e 0xc4000 + 28318
17 libdyld.dylib 0x371bfaae start + 2
Since there is not source code to look at my guess would be you have registered for
an observer for NSNotificationCenter and you have not removed the observer before the
application terminates.
This will cause you problems if an NSNotification was delivered to a deallocated
listener.
It appears one of UIApplicationDidEnterBackgroundNotification listeners is deallocated without unregistering from observing UIApplicationDidEnterBackgroundNotification notification
Related
I can't reproduce some bug that happens sometimes. This is a report:
Exception Type: EXC_CRASH (SIGSEGV)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 1
Thread 0:
0 libobjc.A.dylib 0x3b4b97fa objc_release + 10
1 MyApp 0x00173610 -[AFHTTPRequestOperation error] (AFHTTPRequestOperation.m:136)
2 MyApp 0x001460ea -[RKObjectRequestOperationLogger HTTPOperationDidFinish:] (RKObjectRequestOperation.m:209)
3 CoreFoundation 0x31121e6e __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 10
4 CoreFoundation 0x31095aac _CFXNotificationPost + 1716
5 Foundation 0x31a7bec0 -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
6 Foundation 0x31a807c2 -[NSNotificationCenter postNotificationName:object:] + 26
7 MyApp 0x0017e44e __34-[AFURLConnectionOperation finish]_block_invoke (AFURLConnectionOperation.m:558)
8 libdispatch.dylib 0x3b9a10c0 _dispatch_call_block_and_release + 8
9 libdispatch.dylib 0x3b9a10ac _dispatch_client_callout + 20
10 libdispatch.dylib 0x3b9a39a4 _dispatch_main_queue_callback_4CF + 264
11 CoreFoundation 0x3112a5ac __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 4
12 CoreFoundation 0x31128e78 __CFRunLoopRun + 1304
13 CoreFoundation 0x3109346c CFRunLoopRunSpecific + 520
14 CoreFoundation 0x3109324e CFRunLoopRunInMode + 102
15 GraphicsServices 0x35dcd2e6 GSEventRunModal + 134
16 UIKit 0x33948840 UIApplicationMain + 1132
17 MyApp 0x00014d54 main (main.m:16)
18 libdyld.dylib 0x3b9b5ab4 start + 0
Thread 1 Crashed:
0 libsystem_kernel.dylib 0x3ba59838 kevent64 + 24
1 libdispatch.dylib 0x3b9a80d0 _dispatch_mgr_invoke + 228
2 libdispatch.dylib 0x3b9a261e _dispatch_mgr_thread + 34
What can i understand from such a record? Who can be a culprit?
AFHTTPRequestOperation.m:136 don't looks that can to cause the crash
135: - (NSError *)error {
136: if (!self.HTTPError && self.response) {
137: if (![self hasAcceptableStatusCode] || ![self hasAcceptableContentType]) {
so from where objc_release can come? Does objc_release means that ARC tries to release something from memory? In what period of time (place in code) it can be happened?
providing code of AFURLConnectionOperation.m :
- (void)finish {
self.state = AFOperationFinishedState;
dispatch_async(dispatch_get_main_queue(), ^{
558: [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidFinishNotification object:self];
});
}
Try using the weakSelf code pattern with the block. A weak rather than a strong reference within the block will avoid the release, hopefully.
See the answers here:
What is the proper way to avoid Retain Cycle while using blocks
I actually like the 2nd most popular answer for async. And I really really like it because you have this method called "finish" -- if you happen to make self go away simultaneous with the block being executed, perhaps you get this error.
Hope that works for you.
I keep getting this crash on IOS 6 but I am not sure what is wrong. Does anyone know what it means?
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: EXC_ARM_DA_ALIGN at 0x00000001
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 CoreFoundation 0x3bcab0d8 CFRetain + 20
1 CoreFoundation 0x3bd424ee __CFSetStandardRetainKey + 50
2 VectorKit 0x3840e97c -[VKAnimation _stopAnimation:] + 36
3 VectorKit 0x383d841c -[VKAnimation onTimerFired:] + 48
4 VectorKit 0x383d8240 -[VKMainLoop displayTimerFired:] + 352
5 QuartzCore 0x3664377c CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 156
6 QuartzCore 0x366436d4 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 60
7 IOMobileFramebuffer 0x3c497fd4 IOMobileFramebufferVsyncNotifyFunc + 152
8 IOKit 0x35a965aa IODispatchCalloutFromCFMessage + 190
9 CoreFoundation 0x3bd35888 __CFMachPortPerform + 116
10 CoreFoundation 0x3bd403e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
11 CoreFoundation 0x3bd40386 __CFRunLoopDoSource1 + 134
12 CoreFoundation 0x3bd3f20a __CFRunLoopRun + 1378
13 CoreFoundation 0x3bcb2238 CFRunLoopRunSpecific + 352
14 CoreFoundation 0x3bcb20c4 CFRunLoopRunInMode + 100
15 GraphicsServices 0x33eae336 GSEventRunModal + 70
16 UIKit 0x3be33284 UIApplicationMain + 1116
17 App Name 0x000dcb88 main (main.m:14)
18 App Name 0x000dcb54 start + 36
The application is using the MKMapkit in IOS 6.
This is an internal bug. Report this to Apple.
You may be able to use the Simulator's "Reset Content" thing (in the app/iOS Simulator menu) to clear out caches if this is happening in the Simulator.
Looks like the issue is caused by accessing a released object from within or soon after VectorKit's stopAnimation: method is called. I'm not familiar with VectorKit, so you might look in that method or what looks to be the onTimerFired: delegate callback.
Good luck.
Tim
Today i tried running my app on my iPhone device, and it crashed! It worked perfectly fine on the simulator, I don't know what the problem is.
These are the crash logs:
Identifier: Evader
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2012-09-13 16:41:54.656 -0700
OS Version: iPhone OS 5.1.1 (9B206)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x377d888f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x354dd259 objc_exception_throw + 33
2 CoreFoundation 0x377d8789 +[NSException raise:format:] + 1
3 Foundation 0x380173a3 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 91
4 Evader 0x0012ca41 -[CCSprite initWithTexture:] (CCSprite.m:192)
5 Evader 0x0012c1b1 +[CCSprite spriteWithTexture:] (CCSprite.m:83)
6 Evader 0x0011eb3d -[CCProgressTimer initWithTexture:] (CCProgressTimer.m:69)
7 Evader 0x0011ea55 -[CCProgressTimer initWithFile:] (CCProgressTimer.m:59)
8 Evader 0x0011e9e1 +[CCProgressTimer progressWithFile:] (CCProgressTimer.m:55)
9 Evader 0x00173579 -[HelloWorldLayer lives] (HelloWorldLayer.m:256)
10 Evader 0x001723ed -[HelloWorldLayer init] (HelloWorldLayer.m:101)
11 Evader 0x0010f073 +[CCNode node] (CCNode.m:258)
12 Evader 0x0017bd11 -[StartMenu doThis:] (StartMenu.m:75)
13 CoreFoundation 0x377db7e4 __invoking___ + 68
14 CoreFoundation 0x377367b1 -[NSInvocation invoke] + 161
15 Evader 0x0010aa03 -[CCMenuItem activate] (CCMenuItem.m:129)
16 Evader 0x001085ff -[CCMenu ccTouchEnded:withEvent:] (CCMenu.m:198)
17 CoreFoundation 0x377323fd -[NSObject performSelector:withObject:withObject:] + 53
18 Evader 0x0014f4ff -[CCTouchDispatcher touches:withEvent:withTouchType:] (CCTouchDispatcher.m:268)
19 Evader 0x0014fc43 -[CCTouchDispatcher touchesEnded:withEvent:] (CCTouchDispatcher.m:338)
20 Evader 0x001515c3 -[EAGLView touchesEnded:withEvent:] (EAGLView.m:332)
21 UIKit 0x314c692b -[UIWindow _sendTouchesForEvent:] + 319
22 UIKit 0x314c6319 -[UIWindow sendEvent:] + 381
23 UIKit 0x314ac695 -[UIApplication sendEvent:] + 357
24 UIKit 0x314abf3b _UIApplicationHandleEvent + 5827
25 GraphicsServices 0x33eee22b PurpleEventCallback + 883
26 CoreFoundation 0x377ac523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 39
27 CoreFoundation 0x377ac4c5 __CFRunLoopDoSource1 + 141
28 CoreFoundation 0x377ab313 __CFRunLoopRun + 1371
29 CoreFoundation 0x3772e4a5 CFRunLoopRunSpecific + 301
30 CoreFoundation 0x3772e36d CFRunLoopRunInMode + 105
31 GraphicsServices 0x33eed439 GSEventRunModal + 137
32 UIKit 0x314dacd5 UIApplicationMain + 1081
33 Evader 0x00171029 main (main.m:14)
34 Evader 0x000dec68 start + 40
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3198f32c __pthread_kill + 8
1 libsystem_c.dylib 0x3408c208 pthread_kill + 48
2 libsystem_c.dylib 0x34085298 abort + 88
3 libc++abi.dylib 0x36f12f64 abort_message + 40
4 libc++abi.dylib 0x36f10346 _ZL17default_terminatev + 18
5 libobjc.A.dylib 0x354dd350 _objc_terminate + 140
6 libc++abi.dylib 0x36f103be _ZL19safe_handler_callerPFvvE + 70
7 libc++abi.dylib 0x36f1044a std::terminate() + 14
8 libc++abi.dylib 0x36f1181e __cxa_rethrow + 82
9 libobjc.A.dylib 0x354dd2a2 objc_exception_rethrow + 6
10 CoreFoundation 0x3772e506 CFRunLoopRunSpecific + 398
11 CoreFoundation 0x3772e366 CFRunLoopRunInMode + 98
12 GraphicsServices 0x33eed432 GSEventRunModal + 130
13 UIKit 0x314dacce UIApplicationMain + 1074
14 Evader 0x00171022 main (main.m:14)
15 Evader 0x000dec60 start + 32
I have tried to look for the error, but I do not know what to look for. Can someone help solve this problem?
CCSprite initWithTexture: raises the exception that causes your app to exit. I'm not entirely up on Cocos2d but a quick check in the documentation suggests it raises exceptions on failure to find named files.
That being the case, I'd guess the problem is simply one of filename case. Macs are by default case insensitive. So if you have FunnyImage.png then the simulator will succeed if you attempt to load funnyimage.png.
iOS devices are case sensitive. So it will fail if you attempt to load funnyimage.png.
So probably what you want to do is check that all the filenames you've used in code exactly match the case of the actual files.
The golden rule of using NSNotification seems to be
"call removeObserver before the observer (or the object) is deallocated".
I'm dealing with a codebase where this rule hasn't been followed, but I can't locate the transgression. I've searched through the code and ensured that every addObserver has a matching removeObserver but I'm still seeing crash reports of the following variety:
OS Version: iPhone OS 5.0.1 (9A405)
Report Version: 104
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x8
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x31516fbc objc_msgSend + 16
1 Foundation 0x3195b50f __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_0 + 19
2 CoreFoundation 0x37a02577 ___CFXNotificationPost_block_invoke_0 + 71
3 CoreFoundation 0x3798e0cf _CFXNotificationPost + 1407
4 Foundation 0x318cf3fb -[NSNotificationCenter postNotificationName:object:userInfo:] + 67
5 UIKit 0x34e5ee25 -[UIApplication _handleApplicationSuspend:eventInfo:] + 697
6 UIKit 0x34deed17 -[UIApplication handleEvent:withNewEvent:] + 2031
7 UIKit 0x34dee3bf -[UIApplication sendEvent:] + 55
8 UIKit 0x34dedd2d _UIApplicationHandleEvent + 5809
9 GraphicsServices 0x3750bdf3 PurpleEventCallback + 883
10 CoreFoundation 0x37a0a553 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 39
11 CoreFoundation 0x37a0a4f5 __CFRunLoopDoSource1 + 141
12 CoreFoundation 0x37a09343 __CFRunLoopRun + 1371
13 CoreFoundation 0x3798c4dd CFRunLoopRunSpecific + 301
14 CoreFoundation 0x3798c3a5 CFRunLoopRunInMode + 105
15 GraphicsServices 0x3750afcd GSEventRunModal + 157
16 UIKit 0x34e1c743 UIApplicationMain + 1091
17 App 0x00002d2f main (main.m:14)
My interpretation of this crash report is that [UIApplication _handleApplicationSuspend:eventInfo:] is posting a notification for which an observer has been deallocated before being removed.
Assuming this interpretations is correct, how would I go about determining which notification is being posted? And ideally, what the deallocated object type?
You can set a symbolic breakpoint in -[NSNotificationCenter postNotificationName:object:userInfo:] and print the third argument passed to it (the first being the NSNotificationCenter, the second, _cmd) using the debugger po command.
Another way to determine this is to get the name parameter value (the string you passed for posting the notification) and verify that any object that is observing that string/name is set to remove observation sometime in the objects lifecycle or as it is deallocating.
Okay, I have a program that I'm trying to test on my iPad. I have it all set up so that the app is able to get on the iPad just fine, but running it on the iPad is a different story.
Now, the thing is, my program was working fine on the debug configuration, but now it won't work on that, either. It's strange, because before I was able to get to a certain part of the program before it crashed, but now it's crashing before that.
The debugger is hardly helping. When I use the debugger window, it will step into one line of code, and then suddenly jump back to another line of code.
I really don't understand what's going on. The crash is now occuring in a root view controller that I have set up, called 'FunctionMachineViewController. Here's the code for when it crashes:
-(IBAction)startOnePlayer:(id)sender
{
GameViewController* GameView = [[GameViewController alloc] initWithNibName:nil bundle:nil];
[GameView isOnePlayer:YES withLevel:startLevelNumber];
[self presentModalViewController:GameView animated:YES];
}
GameViewController is supposed to initialize just fine, but the debugger shows it as uninitialized. I even tried setting it up in the header file instead, but the problem still happens. Has anyone else come across these problems? Any help would be greatly appreciated!
EDIT: Here's what the console says when it crashes:
[Session started at 2011-06-02 21:46:10 -0700.]
2011-06-02 21:46:13.309 FunctionMachine[5033:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<GameViewController 0x4b2a890> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Yminus2.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dd55a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f29313 objc_exception_throw + 44
2 CoreFoundation 0x00dd54e1 -[NSException raise] + 17
3 Foundation 0x0003d677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x0003d5e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x004c130c -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00d4b8cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x004bfd23 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x004c1ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x00377628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
10 UIKit 0x00375134 -[UIViewController loadView] + 120
11 UIKit 0x0037500e -[UIViewController view] + 56
12 UIKit 0x00376a3d -[UIViewController viewControllerForRotation] + 63
13 UIKit 0x00372988 -[UIViewController _visibleView] + 90
14 UIKit 0x0061493c -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 354
15 UIKit 0x002ec81e -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 954
16 UIKit 0x00574619 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1381
17 UIKit 0x0037965d -[UIViewController presentModalViewController:withTransition:] + 3478
18 FunctionMachine 0x00001fdd -[FunctionMachineViewController startOnePlayer:] + 227
19 UIKit 0x002c54fd -[UIApplication sendAction:to:from:forEvent:] + 119
20 UIKit 0x00355799 -[UIControl sendAction:to:forEvent:] + 67
21 UIKit 0x00357c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
22 UIKit 0x00356a1c -[UIControl touchesBegan:withEvent:] + 277
23 UIKit 0x002e9d41 -[UIWindow _sendTouchesForEvent:] + 395
24 UIKit 0x002cac37 -[UIApplication sendEvent:] + 447
25 UIKit 0x002cff2e _UIApplicationHandleEvent + 7576
26 GraphicsServices 0x0172d992 PurpleEventCallback + 1550
27 CoreFoundation 0x00db6944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
28 CoreFoundation 0x00d16cf7 __CFRunLoopDoSource1 + 215
29 CoreFoundation 0x00d13f83 __CFRunLoopRun + 979
30 CoreFoundation 0x00d13840 CFRunLoopRunSpecific + 208
31 CoreFoundation 0x00d13761 CFRunLoopRunInMode + 97
32 GraphicsServices 0x0172c1c4 GSEventRunModal + 217
33 GraphicsServices 0x0172c289 GSEventRun + 115
34 UIKit 0x002d3c93 UIApplicationMain + 1160
35 FunctionMachine 0x00001c64 main + 102
36 FunctionMachine 0x00001bf5 start + 53
37 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Turns out that, when I went and changed the name of several UILabels in the header of GameViewController, I forgot to fix the names in the interface builder, too. Don't know if that was what was causing the debugger to act weird, but everything is working now!