简体   繁体   English

单击主页按钮时应用程序崩溃

[英]App is crashing when home button clicked

I have a strage crash scenario to crash the app! 我有一个崩溃的崩溃场景来崩溃应用程序! When you do a fresh install by running the app from Xcode; 当您通过从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. 由于没有源代码可以查看我的猜测,您已经注册了NSNotificationCenter的观察者,并且在应用程序终止之前您还没有删除观察者。

This will cause you problems if an NSNotification was delivered to a deallocated listener. 如果将NSNotification传递给解除分配的侦听器,则会导致问题。

看来, UIApplicationDidEnterBackgroundNotification监听器中的一个被解除分配,而不会从观察UIApplicationDidEnterBackgroundNotification通知中取消注册

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM