1

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
bunjeeb
  • 1,096
  • 1
  • 17
  • 32
  • 2
    What do the crash logs say? – Paul.s Oct 19 '14 at 22:48
  • I updated my question, please see the log, Is there any reason because my in AppStore app was supporting iOS 6 and iPhone 4 & 4s ... And now the minimum is iOS 7 ?? – bunjeeb Oct 19 '14 at 23:03
  • This error is because of posting a notification to an object that is deallocated ! have you used observer pattern i.e NSNotifications in your app ? if yes don't forget to remove the object as an observer before it gets deallocated ! – Nofel Mahmood Oct 19 '14 at 23:10
  • I'm still not able to solve it. I added a break point on remove observer code but crash is happening before!! Also I tried this solution but its not working with me. http://stackoverflow.com/questions/15656367/is-nsnotificationcenter-removeobserver-in-arc-needed The question is why fresh install does not cause a problem? Its only when I download the current deployed version from app store, then click on run from Xcode, and finally, Clicking on Home button will cause the crash :((((( I'm afraid that deploying it will cause w a problem with current customers. – bunjeeb Oct 19 '14 at 23:58

2 Answers2

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.

Gregory Furmanek
  • 364
  • 1
  • 13
1

It appears one of UIApplicationDidEnterBackgroundNotification listeners is deallocated without unregistering from observing UIApplicationDidEnterBackgroundNotification notification

Bartek Chlebek
  • 1,665
  • 1
  • 16
  • 23