2

I have a crash log submitted to iTunes. I am not sure how to recreate the issue, so it is difficult for me to trouble shoot.

[UIDevice setOrientation:animated:] is causing a EXC_BAD_ACCESS crash on iOS 6.

Any suggestions would be greatly appreciated!

Here is the pertinent part of the crash log:

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libobjc.A.dylib                 0x347d9692 objc_msgSend_stret + 18
1   CoreFoundation                  0x3641f034 _CFXNotificationPost
2   Foundation                      0x33ee1d8c -[NSNotificationCenter postNotificationName:object:userInfo:]
3   UIKit                           0x377a5c68 -[UIDevice setOrientation:animated:]
4   UIKit                           0x377a03de -[UIApplication handleEvent:withNewEvent:]
5   UIKit                           0x3779f6d0 -[UIApplication sendEvent:]
6   UIKit                           0x3779f11e _UIApplicationHandleEvent
7   GraphicsServices                0x369525a0 _PurpleEventCallback
8   GraphicsServices                0x369521ce PurpleEventCallback
9   CoreFoundation                  0x364a3170     __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
10  CoreFoundation                  0x364a3112 __CFRunLoopDoSource1
11  CoreFoundation                  0x364a1f94 __CFRunLoopRun
12  CoreFoundation                  0x36414eb8 CFRunLoopRunSpecific
13  CoreFoundation                  0x36414d44 CFRunLoopRunInMode
14  GraphicsServices                0x369512e6 GSEventRunModal
15  UIKit                           0x377f32fc UIApplicationMain
16  MyApp                       0x0001234a main + 70
17  MyApp                       0x000122fc start + 36
Jeshua Lacock
  • 5,730
  • 1
  • 28
  • 58
  • It is not causing it, whatever you are doing to respond to it is causing it. Look over what you are doing in methods that respond to device orientation changes. – borrrden Nov 07 '12 at 08:53
  • That makes sense, but darn, that doesn't narrow it down much. Most objects I have handle rotation events... – Jeshua Lacock Nov 07 '12 at 09:27
  • It's likely only "device" orientation changes (face up, face down, etc), not "interface" orientation changes (portrait, landscape) but I am not sure – borrrden Nov 07 '12 at 09:37

2 Answers2

1

I dont think it's a live object that messes up. I'd say that you forgot to unregister an observer and it got deallocated but is still scheduled to get notifications -- look at any class that subscribes to this particular notification and see if add/removes are balanced

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
  • I would agree, but I checked every object that uses a notification and I am removing the notification in all the objects in dealloc. That said, in some of the dealloc methods, I was not removing the notifcation first; I was removing it after releasing some objects. I suppose there is a very slight possibility that could have caused it, so I moved the de-notification to the top of each dealloc method. – Jeshua Lacock Nov 08 '12 at 19:26
  • 1
    Try running it in instruments with zombies enabled if it still occurs. – Daij-Djan Nov 08 '12 at 20:26
  • See the original post; I am unable to recreate the issue. I only have a crash log that was submitted to iTunes to work with. – Jeshua Lacock Nov 09 '12 at 20:12
  • 1
    @downvoter why? my answer fits to the crash report shown – Daij-Djan May 19 '15 at 08:51
  • 1
    Stop downvoting other people just because you don't like the answer or it doesn't solve the problem 100 %. As long its not totally offtopic it helps to solve problems. – Alex Cio May 19 '15 at 09:03
1

Like @Daij-Djan already mentioned, it can't be the orientation change itself, because there is still a post of NSNotification and than the app is crashing. Have again a look at the classes you have added NSNotificationCenter to, maybe there is no problem on unregistering but on registering like the post I found here.

Community
  • 1
  • 1
Alex Cio
  • 6,014
  • 5
  • 44
  • 74