I'm getting a strange error with core data. Sometimes, but not all the time my app will crash when I try to access a core data object.
It happens regularly on iPhone 3's and only sometimes on iPhone 4's. I looked at my device log and narrowed it down to an issue with core data. The line the logs refer to is below, tripInstructor is a core data object, its a property of the AppManager class. Not sure if this makes a big difference but I do declare the property as being "nonatomic, retain".
Thanks for any advice
[self.supervisorLbl setText:[AppManager sharedAppManager].tripInstructor.name];
Date/Time: 2011-06-12 20:55:24.865 +1000
OS Version: iPhone OS 4.3.3 (8J2)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x33e8da1c pthread_kill + 8
1 libsystem_c.dylib 0x35e5b3b4 pthread_kill + 52
2 libsystem_c.dylib 0x35e53bf8 abort + 72
3 libstdc++.6.dylib 0x33508a64 __gnu_cxx::__verbose_terminate_handler() + 376
4 libobjc.A.dylib 0x33f1106c _objc_terminate + 104
5 libstdc++.6.dylib 0x33506e36 _cxxabiv1::_terminate(void (*)()) + 46
6 libstdc++.6.dylib 0x33506e8a std::terminate() + 10
7 libstdc++.6.dylib 0x33506efe __cxa_rethrow + 62
8 libobjc.A.dylib 0x33f10fd8 objc_exception_rethrow + 4
9 CoreData 0x35624f66 _PFFaultHandlerLookupRow + 1450
10 CoreData 0x356799ba -[NSFaultHandler fulfillFault:withContext:] + 14
11 CoreData 0x35678782 _PF_FulfillDeferredFault + 354
12 CoreData 0x35623f18 _sharedIMPL_pvfk_core + 52
13 CoreData 0x35626b68 _pvfk_5 + 4
14 eLogger 0x0000e346 -[VicLogVC viewWillAppear:] (VicLogVC.m:207)
15 UIKit 0x3636bf14 -[UINavigationController _startTransition:fromViewController:toViewController:] + 604
16 UIKit 0x3636bc3c -[UINavigationController _startDeferredTransitionIfNeeded] + 176
17 UIKit 0x3635dd56 -[UINavigationController pushViewController:transition:forceImmediate:] + 634
18 UIKit 0x3635dacc -[UINavigationController pushViewController:animated:] + 28
19 eLogger 0x00025332 -[TripScreenVC _populateAndDisplayVicLog] (TripScreenVC.m:221)
20 eLogger 0x00025492 -[TripScreenVC _determineLogScreen] (TripScreenVC.m:258)
21 eLogger 0x000255d4 -[TripScreenVC buttonPressed:] (TripScreenVC.m:307)
22 CoreFoundation 0x30d4356a -[NSObject(NSObject) performSelector:withObject:withObject:] + 18
23 UIKit 0x36343ec2 -[UIApplication sendAction:to:from:forEvent:] + 78
24 UIKit 0x36343e62 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 26
25 UIKit 0x36343e34 -[UIControl sendAction:to:forEvent:] + 32
26 UIKit 0x36343b86 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 350
27 UIKit 0x3634441c -[UIControl touchesEnded:withEvent:] + 336
28 UIKit 0x36342bee -[UIWindow _sendTouchesForEvent:] + 362
29 UIKit 0x36342568 -[UIWindow sendEvent:] + 256
30 UIKit 0x3632b30c -[UIApplication sendEvent:] + 292
31 UIKit 0x3632ac4c _UIApplicationHandleEvent + 5084
32 GraphicsServices 0x34e2be70 PurpleEventCallback + 660
33 CoreFoundation 0x30daaa90 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 20
34 CoreFoundation 0x30dac838 __CFRunLoopDoSource1 + 160
35 CoreFoundation 0x30dad606 __CFRunLoopRun + 514
36 CoreFoundation 0x30d3debc CFRunLoopRunSpecific + 224
37 CoreFoundation 0x30d3ddc4 CFRunLoopRunInMode + 52
38 GraphicsServices 0x34e2b418 GSEventRunModal + 108
39 GraphicsServices 0x34e2b4c4 GSEventRun + 56
40 UIKit 0x36355d62 -[UIApplication _run] + 398
41 UIKit 0x36353800 UIApplicationMain + 664
42 eLogger 0x00002ff8 main (main.m:14)
43 eLogger 0x00002fa0 start + 32
You are likely holding on to an invalid reference to a managed object, it looks like it was turned into a fault by the managed object context, perhaps after calling -save: or -reset on the context.
If you deleted an object from your store, and still held a reference to the managed object in the ivar then that could be the cause of this error. The object will be deleted by CoreData and turned into a fault when -save: is called (at which point you should nil and reset your ivars). But, when you try to fault the object (by accessing one or more of it's properties) it won't be found in the store because you deleted it.
Related
I have an App that works perfectly on Debug (device and simulator) but once I archive it for AdHoc it just crashes.
Even with the Distribution provision files selected y clic play and works fine.
Now if I make an .ipa through AdHoc... it loads and crashes... 1seg... not even open.
I guess maybe something is wrong, but how on earth I can find the bug if there's any? I don't have any log message and it's a big big App.
Any idea?
Thanks.
By the way, this is what I get:
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x38af35d0 objc_msgSend + 16
1 CoreFoundation 0x39a0d4e8 CFURLCopyScheme + 144
2 CoreGraphics 0x318e6e28 CGDataProviderCreateWithURL + 44
3 CoreGraphics 0x318ffc5c CGPDFDocumentCreateWithURL + 4
4 READERSoft 0x000e10f0 CGPDFDocumentCreateX (CGPDFDocument.m:42)
5 READERSoft 0x000aeab4 -[ContentViewController viewDidLoad] (ContentViewController.m:56)
6 UIKit 0x332ce544 -[UIViewController loadViewIfRequired] + 360
7 UIKit 0x3330ed2c -[UIWindow addRootViewControllerViewIfPossible] + 60
8 UIKit 0x3330aac8 -[UIWindow _setHidden:forced:] + 360
9 UIKit 0x3334c19c -[UIWindow makeKeyAndVisible] + 56
10 READERSoft 0x000b618a -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:44)
11 UIKit 0x3330fa74 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 248
12 UIKit 0x3330f5f8 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1164
13 UIKit 0x33307806 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 694
14 UIKit 0x332afcea -[UIApplication handleEvent:withNewEvent:] + 1006
15 UIKit 0x332af778 -[UIApplication sendEvent:] + 68
16 UIKit 0x332af1ba _UIApplicationHandleEvent + 6194
17 GraphicsServices 0x39b435f4 _PurpleEventCallback + 588
18 GraphicsServices 0x39b43222 PurpleEventCallback + 30
19 CoreFoundation 0x39a743e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
20 CoreFoundation 0x39a74386 __CFRunLoopDoSource1 + 134
21 CoreFoundation 0x39a7320a __CFRunLoopRun + 1378
22 CoreFoundation 0x399e6238 CFRunLoopRunSpecific + 352
23 CoreFoundation 0x399e60c4 CFRunLoopRunInMode + 100
24 UIKit 0x33306440 -[UIApplication _run] + 664
25 UIKit 0x3330328c UIApplicationMain + 1116
26 READERSoft 0x000b5f5a main (main.m:9)
27 READERSoft 0x000ae89c start + 36
I have one application and in beta testing i got my application crash but i am not able to understand what is wrong with it, can you suggest me where to look, Thanks :)
0 TurfNutritionTool_ver_5.1 0x00189642 testflight_backtrace + 142
1 TurfNutritionTool_ver_5.1 0x0018a1d0 TFSignalHandler + 212
2 libsystem_c.dylib 0x3174872e _sigtramp + 42
3 UIKit 0x362f2aa0 -[UITableView dealloc] + 56
4 CoreFoundation 0x317b5c42 -[NSObject(NSObject) release] + 30
5 libobjc.A.dylib 0x3125d50c objc_setProperty_non_gc + 120
6 libobjc.A.dylib 0x31255046 objc_setProperty + 26
7 TurfNutritionTool_ver_5.1 0x001051c8 -[TNTScenarioViewController setScenarioTable:] (TNTScenarioViewController.m:15)
8 TurfNutritionTool_ver_5.1 0x00103610 -[TNTScenarioViewController viewDidUnload] (TNTScenarioViewController.m:160)
9 UIKit 0x362a9a28 -[UIViewController unloadViewForced:] + 172
10 UIKit 0x362b96b8 -[UIViewController unloadViewIfReloadable] + 16
11 UIKit 0x3630012c -[UIViewController purgeMemoryForReason:] + 40
12 UIKit 0x3630014c -[UIViewController didReceiveMemoryWarning] + 16
13 TurfNutritionTool_ver_5.1 0x00102682 -[TNTScenarioViewController didReceiveMemoryWarning] (TNTScenarioViewController.m:40)
14 UIKit 0x36300162 -[UIViewController _didReceiveMemoryWarning:] + 14
15 Foundation 0x3113f182 _nsnote_callback + 142
16 CoreFoundation 0x3182020e __CFXNotificationPost_old + 402
17 CoreFoundation 0x317baeea _CFXNotificationPostNotification + 118
18 Foundation 0x3113c5d2 -[NSNotificationCenter postNotificationName:object:userInfo:] + 70
19 Foundation 0x3113e1c0 -[NSNotificationCenter postNotificationName:object:] + 24
20 UIKit 0x362d6360 -[UIApplication _performMemoryWarning] + 48
21 UIKit 0x362d6d82 -[UIApplication _receivedMemoryNotification] + 126
22 UIKit 0x362d4506 _memoryStatusChanged + 42
23 CoreFoundation 0x31820d68 __CFNotificationCenterDarwinCallBack + 24
24 CoreFoundation 0x3181dbde __CFMachPortPerform + 210
25 CoreFoundation 0x31828a96 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
26 CoreFoundation 0x3182a83e __CFRunLoopDoSource1 + 166
27 CoreFoundation 0x3182b60c __CFRunLoopRun + 520
28 CoreFoundation 0x317bbec2 CFRunLoopRunSpecific + 230
29 CoreFoundation 0x317bbdca CFRunLoopRunInMode + 58
30 GraphicsServices 0x336d641e GSEventRunModal + 114
31 GraphicsServices 0x336d64ca GSEventRun + 62
32 UIKit 0x361abd68 -[UIApplication _run] + 404
33 UIKit 0x361a9806 UIApplicationMain + 670
34 TurfNutritionTool_ver_5.1 0x000edb68 main (main.m:14)
35 TurfNutritionTool_ver_5.1 0x000edb27 start + 39
Are you familiar with the concept of a stack trace? What you are looking at are the lines of code execution from the crash (0) back to a recent frame entry. As such, this is referred to as a 'back trace' since it goes backwards from the point that the code stopped executing.
I have no knowledge of your code, but you can see from line 14 of the back trace that you received a low memory warning. This warning caused a chain of unload events, including a deallocation of a UITableView (line 3).
This is immediately followed by the _sigtramp, which probably indicates an EXC_BAD_ACCESS. My guess, without seeing the rest of your code, is that you are accessing something that has been released by the low memory unload situation.
I have a strange problem with my app, sometimes, very rare in fact, when run on iPhone4, it crashes right at the beginning, I got the crash log, but I really can't make anything of it. I'm kind of stuck, where should I look? Here is the log:
0 libsystem_kernel.dylib 0x34c96a1c __pthread_kill + 8
1 libsystem_c.dylib 0x328ee3b4 pthread_kill + 52
2 libsystem_c.dylib 0x328e6bf8 abort + 72
3 libsystem_c.dylib 0x329146d4 __assert_rtn + 140
4 My App 0x0000fb8c 0x1000 + 60300
5 My App 0x0000fec4 0x1000 + 61124
6 My App 0x00009ffc 0x1000 + 36860
7 CoreFoundation 0x359c979c __invoking___ + 60
8 CoreFoundation 0x35941436 -[NSInvocation invoke] + 102
9 My App 0x0005f408 0x1000 + 386056
10 My App 0x0005c9b8 0x1000 + 375224
11 CoreFoundation 0x3593656a -[NSObject(NSObject) performSelector:withObject:withObject:] + 18
12 My App 0x000b60d4 0x1000 + 741588
13 My App 0x000b6bc0 0x1000 + 744384
14 My App 0x000b8c9c 0x1000 + 752796
15 UIKit 0x35584bee -[UIWindow _sendTouchesForEvent:] + 362
16 UIKit 0x35584568 -[UIWindow sendEvent:] + 256
17 UIKit 0x3556d30c -[UIApplication sendEvent:] + 292
18 UIKit 0x3556cc4c _UIApplicationHandleEvent + 5084
19 GraphicsServices 0x35350e70 PurpleEventCallback + 660
20 CoreFoundation 0x3599da90 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
21 CoreFoundation 0x3599f838 __CFRunLoopDoSource1 + 160
22 CoreFoundation 0x359a0606 __CFRunLoopRun + 514
23 CoreFoundation 0x35930ebc CFRunLoopRunSpecific + 224
24 CoreFoundation 0x35930dc4 CFRunLoopRunInMode + 52
25 GraphicsServices 0x35350418 GSEventRunModal + 108
26 GraphicsServices 0x353504c4 GSEventRun + 56
27 UIKit 0x35597d62 -[UIApplication _run] + 398
28 UIKit 0x35595800 UIApplicationMain + 664
29 My App 0x00002118 0x1000 + 4376
30 My App 0x00002084 0x1000 + 4228
I was not able to find any pattern for the crash, it simply happens like maybe once in 30-40 app start-ups. What beats me, beside the fact that I don't know how the interpret the crash log, is why this happens so rare, with no apparent reason?
You need to symbolicate that crash log before you can see exactly which part of your code is crashing.
I have a problem with my iPhone app, I have a crash log from a tester that i ran through symbolicatecrash but I'm still not sure what could be causing it. The crash only happens on one tester's device and I am unable to reproduce it on my device.
Hardware Model: iPhone2,1
OS Version: iPhone OS 4.0.1 (8A306)
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x534f5031
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000286c objc_msgSend + 16
1 UIKit 0x000765c6 -[UINavigationItem _updateViewsForBarSizeChangeIfNecessary] + 30
2 UIKit 0x000a26c8 -[UINavigationBar _popNavigationItemWithTransition:] + 212
3 UIKit 0x000a25d0 -[UINavigationBar popNavigationItemAnimated:] + 76
4 UIKit 0x000a2492 -[UINavigationBar _handleMouseUpAtPoint:] + 390
5 UIKit 0x000a22f2 -[UINavigationBar touchesEnded:withEvent:] + 54
6 UIKit 0x000614e6 -[UIWindow _sendTouchesForEvent:] + 362
7 UIKit 0x00060e60 -[UIWindow sendEvent:] + 256
8 UIKit 0x0005cb54 -[UIApplication sendEvent:] + 292
9 UIKit 0x0005c500 _UIApplicationHandleEvent + 5016
10 GraphicsServices 0x00004140 PurpleEventCallback + 660
11 CoreFoundation 0x00071aa4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
12 CoreFoundation 0x00073848 __CFRunLoopDoSource1 + 160
13 CoreFoundation 0x00074626 __CFRunLoopRun + 514
14 CoreFoundation 0x0001d8e4 CFRunLoopRunSpecific + 224
15 CoreFoundation 0x0001d7ec CFRunLoopRunInMode + 52
16 GraphicsServices 0x000036e8 GSEventRunModal + 108
17 GraphicsServices 0x00003794 GSEventRun + 56
18 UIKit 0x000062a0 -[UIApplication _run] + 396
19 UIKit 0x00004e10 UIApplicationMain + 664
20 app 0x0000240c main (main.m:14)
21 app 0x000023a8 start + 44
The crash happens from taking a photo, going to new view, manipulating photo, saving it, sending it, returning to the previous view and then trying to go back to the view before that.
Make sure you're properly retaining and releasing your nib objects as outlined here.
Can anyone tell me how to analyse the iPhone's device log?
In addition, can anyone explain what the following means?
0 libobjc.A.dylib 0x00007dd2 prepareForMethodLookup + 10",
Thread 0 Crashed:
0 libobjc.A.dylib 0x00007dd2 prepareForMethodLookup + 10
1 libobjc.A.dylib 0x00005162 lookUpMethod + 34
2 libobjc.A.dylib 0x0000290e _class_lookupMethodAndLoadCache + 6
3 libobjc.A.dylib 0x00002644 objc_msgSend_uncached + 20
4 iPad4HB 0x0002f112 0x1000 + 188690
5 iPad4HB 0x00010c86 0x1000 + 64646
6 CoreFoundation 0x00025166 -[NSObject performSelector:withObject:withObject:] + 18
7 UIKit 0x00055166 -[UIApplication sendAction:to:from:forEvent:] + 78
8 UIKit 0x00055106 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 26
9 UIKit 0x000550d8 -[UIControl sendAction:to:forEvent:] + 32
10 UIKit 0x00054e2a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 350
11 UIKit 0x0019a4f2 -[UISlider endTrackingWithTouch:withEvent:] + 166
12 UIKit 0x00055444 -[UIControl touchesEnded:withEvent:] + 284
13 UIKit 0x00053e4e -[UIWindow _sendTouchesForEvent:] + 322
14 UIKit 0x00053796 -[UIWindow sendEvent:] + 74
15 UIKit 0x0004f3b8 -[UIApplication sendEvent:] + 260
16 UIKit 0x0004ed24 _UIApplicationHandleEvent + 4772
17 GraphicsServices 0x00003b2c PurpleEventCallback + 660
18 CoreFoundation 0x00022d96 CFRunLoopRunSpecific + 2214
19 CoreFoundation 0x000224da CFRunLoopRunInMode + 42
20 GraphicsServices 0x000030d4 GSEventRunModal + 108
21 GraphicsServices 0x00003180 GSEventRun + 56
22 UIKit 0x000034c2 -[UIApplication _run] + 374
23 UIKit 0x000019ec UIApplicationMain + 636
24 iPad4HB 0x00002d68 0x1000 + 7528
25 iPad4HB 0x00002d1c 0x1000 + 7452
What you are looking at is a stack trace. It shows all function and method calls that your application made in a specific thread. Up to the point where it crashed.
The first line ('distance' 0) is the most recent location. So this is the place where the application most likely crashed.
The last line ('distance' 25) is the start of the application.
The libobjc.A.dylib is the place where the application crashed. This can show libraries (libobjc.A.dylib) , frameworks (UIKit) and your application (iPad4HB).
The hexadecimal number (0x00007dd2) is the memory location of that specific function or method.
The next column shows the actual function or method name. Where prepareForMethodLookup is a plain C function while -[NSObject performSelector:withObject:] is a method.
The '+ 10' is an indication of where in the function or method the call to the next method or function was made. It is an offset into the compiled code of the function, so this number is mostly meaningless.
However, if you kept your .dSYM file, then you can convert the number to a real line number in a specific file.
See for example http://www.anoshkin.net/blog/2008/09/09/iphone-crash-logs/