I am developing an application to take photos and upload the photos to remote server.
I have customized camera view using overlay view. App allows to take more than 1 photos per time and photos will be saved to device just after taking photos. When I am taking photos app gives memory warning and then crash. Followings are the from crash report. I have talked with Apple support team and they said this is not due to memory issue. This is because of trying to send an action to one of your controller object that no longer exists.
OS Version: iPhone OS 4.3.3 (8J2)
Report Version: 104
Exception Type: EXC_BAD_ACCESS
(SIGSEGV) Exception Codes:
KERN_INVALID_ADDRESS at 0x73980000
Crashed Thread: 0
Thread 0 name: Dispatch queue:
com.apple.main-thread Thread 0
Crashed: 0 libobjc.A.dylib
0x34499c9a objc_msgSend + 18 1
UIKit
0x30a8bc1a
-[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 86 2 CoreFoundation
0x308f056a -[NSObject(NSObject)
performSelector:withObject:withObject:]
+ 18 3 UIKit 0x309feec2 -[UIApplication
sendAction:to:from:forEvent:] + 78 4
UIKit
0x309fee62 -[UIApplication
sendAction:toTarget:fromSender:forEvent:]
+ 26 5 UIKit 0x309fee34 -[UIControl
sendAction:to:forEvent:] + 32 6
UIKit
0x309feb86 -[UIControl(Internal)
_sendActionsForEvents:withEvent:] + 350 7 UIKit
0x309ff41c -[UIControl
touchesEnded:withEvent:] + 336 8
UIKit
0x309e452e
_UIGestureRecognizerSortAndSendDelayedTouches
+ 2194 9 UIKit 0x309e3bfa
_UIGestureRecognizerUpdateObserver + 690 10 CoreFoundation
0x30957a2e
CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION
+ 10 11 CoreFoundation 0x3095945e __CFRunLoopDoObservers +
406 12 CoreFoundation
0x3095a754 __CFRunLoopRun + 848 13
CoreFoundation
0x308eaebc CFRunLoopRunSpecific + 224
14 CoreFoundation
0x308eadc4 CFRunLoopRunInMode + 52 15
GraphicsServices
0x30269418 GSEventRunModal + 108 16
GraphicsServices
0x302694c4 GSEventRun + 56 17 UIKit
0x30a10d62 -[UIApplication _run] +
398 18 UIKit
0x30a0e800 UIApplicationMain + 664 19
hand-e-pix
0x000025a4 main (main.m:14) 20
hand-e-pix
0x0000254c start + 32
Can anyone please help me to identify what cause this problem?
Many Thanks
Regards
Chin
This could easily be related to a retain/release issue. Make sure you balance your reetain/release calls. Also make sure you do not reference any deallocated objects in your code.
You might want to take a look at enabling NSZombieEnabled in order to track this one down.
You can find information about how to enable it here.
Related
Good morning,
I have released a new app on the AppStore. It worked fine on simulator, in different devices (both iPhone 4 and iPhone 5) and also worked using testflight.
Today, my app has been approved and it is in the AppStore. The problem is that it works perfectly on iphone 4 but not on iPhone 5.
The log is:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x333363e2 __exceptionPreprocess + 158
1 libobjc.A.dylib 0x3b03195e objc_exception_throw + 26
2 UIKit 0x354d161c +[UIStoryboard storyboardWithName:bundle:] + 436
3 Torero 0x00054008 -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:27)
4 UIKit 0x351a5a9c -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 248
5 UIKit 0x351a5620 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1164
6 UIKit 0x3519d82e -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 694
7 UIKit 0x35145d1a -[UIApplication handleEvent:withNewEvent:] + 1006
8 UIKit 0x351457a8 -[UIApplication sendEvent:] + 68
9 UIKit 0x351451ea _UIApplicationHandleEvent + 6194
10 GraphicsServices 0x36e5d5f2 _PurpleEventCallback + 586
11 GraphicsServices 0x36e5d222 PurpleEventCallback + 30
12 CoreFoundation 0x3330b3e2 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 30
13 CoreFoundation 0x3330b386 __CFRunLoopDoSource1 + 134
14 CoreFoundation 0x3330a20a __CFRunLoopRun + 1378
15 CoreFoundation 0x3327d238 CFRunLoopRunSpecific + 352
16 CoreFoundation 0x3327d0c4 CFRunLoopRunInMode + 100
17 UIKit 0x3519c468 -[UIApplication _run] + 664
18 UIKit 0x351992b4 UIApplicationMain + 1116
19 Torero 0x00053e8e main (main.m:16)
20 Torero 0x00053e44 0x52000 + 7748
I think that the problem is in the selector of storyboard in application:didFinishLaunchingWithOptions so I have copied my old iphone 5 storyboard in a new one, changed name and uploaded a new version of my app.
Do you think it will work? Do you think should I do anything else?
Thank you very much
Works on simulator but not on device? Check capitalization of your file names. File names on device are case-sensitive, on simulator they are not.
My app (named MyLittleApplication) crashes randomly when I click on a button that pops view controller.
I could use some help (to find out where should I start looking) with crash log:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x600332e0
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x351faf78 objc_msgSend + 16
1 Foundation 0x37d0a74c NSKVOPendingNotificationCreate + 216
2 Foundation 0x37d0a652 NSKeyValuePushPendingNotificationPerThread + 62
3 Foundation 0x37cfc744 NSKeyValueWillChange + 408
4 Foundation 0x37cd3848-[NSObject(NSKeyValueObserverNotification) willChangeValueForKey:] + 176
5 Foundation 0x37d55a14 _NSSetPointValueAndNotify + 76
6 UIKit 0x311f825a -[UIScrollView(Static) _adjustContentOffsetIfNecessary] + 1890
7 UIKit 0x31215a54 -[UIScrollView setFrame:] + 548
8 UIKit 0x31215802 -[UITableView setFrame:] + 182
9 POViO 0x000fcac8 0xf8000 + 19144
10 UIKit 0x31211b8e -[UIViewController _setViewAppearState:isAnimating:] + 138
11 UIKit 0x3126b8a8 -[UIViewController beginAppearanceTransition:animated:] + 184
12 UIKit 0x3121490c -[UINavigationController _startTransition:fromViewController:toViewController:] + 832
13 UIKit 0x312144fc -[UINavigationController _startDeferredTransitionIfNeeded] + 244
14 UIKit 0x3125e8e4 _popViewControllerNormal + 184
15 UIKit 0x3125e712 -[UINavigationController _popViewControllerWithTransition:allowPoppingLast:] + 386
16 UIKit 0x31242bba -[UINavigationController popToViewController:transition:] + 626
17 POViO 0x001074e6 0xf8000 + 62694
18 CoreFoundation 0x374553f6 -[NSObject performSelector:withObject:withObject:] + 46
19 UIKit 0x311eae00 -[UIApplication sendAction:to:from:forEvent:] + 56
20 UIKit 0x311eadbc -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 24
21 UIKit 0x311ead9a -[UIControl sendAction:to:forEvent:] + 38
22 UIKit 0x311eab0a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 486
23 UIKit 0x311eb442 -[UIControl touchesEnded:withEvent:] + 470
24 UIKit 0x311e9924 -[UIWindow _sendTouchesForEvent:] + 312
25 UIKit 0x311e9312 -[UIWindow sendEvent:] + 374
26 UIKit 0x311cf68e -[UIApplication sendEvent:] + 350
27 UIKit 0x311cef34 _UIApplicationHandleEvent + 5820
28 GraphicsServices 0x33c11224 PurpleEventCallback + 876
29 CoreFoundation 0x374cf51c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
30 CoreFoundation 0x374cf4be __CFRunLoopDoSource1 + 134
31 CoreFoundation 0x374ce30c __CFRunLoopRun + 1364
32 CoreFoundation 0x3745149e CFRunLoopRunSpecific + 294
33 CoreFoundation 0x37451366 CFRunLoopRunInMode + 98
34 GraphicsServices 0x33c10432 GSEventRunModal + 130
35 UIKit 0x311fdcce UIApplicationMain + 1074
36 MyLittleApplication 0x000f90ae 0xf8000 + 4270
37 MyLittleApplication 0x000f9048 0xf8000 + 4168
I suspect that it has something to do with notificationCenter and UIDeviceOrientationDidChangeNotifications I use. Is this true or am I looking in the wrong direction?
I am calling
[notificationCenter removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil]
in viewDidUnload, this shuld be enough?
Can you please tell me what bug should i start looking for?
This is a stacktrace you see the stack of methods called when the crash happened.
You start at the bottom and work yourself up to the top and search for a method call from your app (the stacktrace includes calls from the frameworks too (e.g. -[UIScrollView(Static) _adjustContentOffsetIfNecessary])).
The topmost method call from your app is likely the cause of your error and you can see what the system tried afterwards.
In your case it seems that you call popToViewController and the iOS frameworks try to animate the transition from one UIViewController to the next. There seems to be a problem for the table view to set its frame and scroll to the contentOffset.
This is likely to be caused by a memory error. You get this hint by examining Exception Type: EXC_BAD_ACCESS (SIGSEGV)
EXC_BAD_ACCESS is likely a hint that you try to acces a something which is no more in the memory -> already released.
In general I would recomment to activate exveption breakpoints in Xcode:
Have you set the exception breakpoint?
got to breakpoint editor pane
click on the x in the bottom left corner
choose add exception breakpoint
Now you should see a stacktrace if an exception occurs. And Xcode should be at the line where the crash happens.
The second thing you should get familiar with is the zombie mode in Instruments.
You can find a good introduction to the zombi mode in this video.
In your case, you can see you have a EXC_BAD_ACCESS (SIGSEGV). This means you're trying to access something which isn't here, or at least was here but isn't anymore. If you can replicate the error, try using the Zombies mode of Instruments, it will tell will which thing it was expecting to access. The solution to this problem is often that you released the resource too early a resource you still need.
You might want to throw some NSLog statements in the methods just so you can have an idea of where things are going wrong. Sometimes those iOS messages can be a little cryptic.
My app crashes when I do [self.navigationController popViewControllerAnimated:YES].
It crashes more on Device than on Simulator. Please suggest how to fix this?
Date/Time: 2010-11-09 10:51:41.325 +0800
OS Version: iPhone OS 4.0.1 (8A306)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000286e objc_msgSend + 18
1 CoreFoundation 0x00002c30 -[NSObject(NSObject) release] + 24
2 libobjc.A.dylib 0x00003c1a objc_setProperty + 114
3 UIKit 0x000693d4 -[UINavigationController setDisappearingViewController:] + 24
4 UIKit 0x0007d5c0 -[UINavigationController _clearLastOperation] + 40
5 UIKit 0x0007d4b4 -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] + 556
6 UIKit 0x0007d248 -[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:] + 204
7 UIKit 0x0007d0b6 -[UINavigationTransitionView _navigationTransitionDidStop] + 450
8 UIKit 0x00059974 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 184
9 UIKit 0x0005987e -[UIViewAnimationState animationDidStop:finished:] + 34
10 QuartzCore 0x000127ba run_animation_callbacks(double, void*) + 286
11 QuartzCore 0x0001265c CA::timer_callback(__CFRunLoopTimer*, void*) + 116
12 CoreFoundation 0x00071a54 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
13 CoreFoundation 0x00073ede __CFRunLoopDoTimer + 854
14 CoreFoundation 0x0007485e __CFRunLoopRun + 1082
15 CoreFoundation 0x0001d8e4 CFRunLoopRunSpecific + 224
16 CoreFoundation 0x0001d7ec CFRunLoopRunInMode + 52
17 GraphicsServices 0x000036e8 GSEventRunModal + 108
18 GraphicsServices 0x00003794 GSEventRun + 56
19 UIKit 0x000062a0 -[UIApplication _run] + 396
20 UIKit 0x00004e10 UIApplicationMain + 664
21 tenpay 0x00006124 main (main.m:13)
22 tenpay 0x00002324 start + 44
myviewcontroller = [[[MyViewController alloc]init]autorelease];
[self.navigationController pushViewController:myviewcontroller animated:YES];
[myviewcontroller release]; //This is my bug !!! I just fixed it.
This usually means you are sending a message to a released object which is a bad idea.
From the stack you can see that it is sending a release message to an object. I'd suggest that the object has already been released and thus hasa retain count of 0. Therefore a further release would be invalid.
I believe if you turn on a flag, I think it's called Zombie detection or something like that, then any message to a released object will generate a more descriptive message.
Perhaps a more experienced developer can jump in here with more details.
Yes, I believe Derek is pointing you in the right direction. Could you possibly list what kind of memory-related operations you are performing on the active controller before sending this release message (the release message is being sent implicitly when you try to pop it out). Please clarify if you are using autorelease for this controller,etc... Also it might be helpful to see what are the associated properties that you may have associated with this controller (ex: #property(nonatomic, retain, etc...)) if there are any.
I am trying to figure out what is causing this crash. I have built and given the app to our testers but we cannot seem to reproduce this reliably. It just happens sometimes...
Thread 0 Crashed:
0 libobjc.A.dylib 0x000027da objc_msgSend + 18
1 Foundation 0x00032896 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 62
2 Foundation 0x00032818 _NSURLConnectionDidFinishLoading + 72
3 CFNetwork 0x00010dd8 URLConnectionClient::_clientDidFinishLoading(URLConnectionClient::ClientConnectionEventQueue*) + 160
4 CFNetwork 0x00004ad4 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 96
5 CFNetwork 0x000049c4 URLConnectionClient::processEvents() + 64
6 CFNetwork 0x00004976 URLConnection::multiplexerClientPerform(RunLoopMultiplexer*) + 30
7 CFNetwork 0x000048f4 MultiplexerSource::perform() + 120
8 CFNetwork 0x00004872 MultiplexerSource::_perform(void*) + 2
9 CoreFoundation 0x00055f1e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
10 CoreFoundation 0x00027ba0 __CFRunLoopDoSources0 + 376
11 CoreFoundation 0x00027444 __CFRunLoopRun + 224
12 CoreFoundation 0x00027270 CFRunLoopRunSpecific + 224
13 CoreFoundation 0x00027178 CFRunLoopRunInMode + 52
14 GraphicsServices 0x000045ec GSEventRunModal + 108
15 GraphicsServices 0x00004698 GSEventRun + 56
16 UIKit 0x0000411c -[UIApplication _run] + 396
17 UIKit 0x00002128 UIApplicationMain + 664
18 myapp 0x000020d8 main (main.m:14)
19 myapp 0x0000208c start + 32
Any advice would be greatly appreciated. The app is built in XCode 3.2.4 using SDK 4.1.
Cheers...
I would try turning on NSZombieEnabled and see if that sheds any light on the issue. Is the delegate for the connection still around and valid?
Ben has some sound advice. Turn NSZombieEnabled to on.
I can tell you with almost 100% certainty that it is crashing because you have a nil object when the delegate is attempting to send it a message.
The fact that it is only crashing sometimes, tells me that you are probably using autorelease. Autorelease never decrements the retain count at exactly the same time, so sometimes your object will still be alive when it gets a delegate message and the app works. However, sometimes that object will have been released and the app crashes.
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.