我有一个应用程序在iPhone上崩溃,但只有当它通过
Xcode启动时.
@H_502_24@解决方法
我可以在iPhone控制台日志中看到应用程序收到内存警告,然后有一些奇怪的事件,如下所示:
Sun Jul 11 00:03:43 Matts-iPhone com.apple.launchd[1] (UIKitApplication:com.mycom.myapp[0x3f60][5591]) <Notice>: (UIKitApplication:com.mycom.myapp[0x3f60]) Bug: launchd_core_logic.c:3270 (24132):0 Sun Jul 11 00:03:43 Matts-iPhone com.apple.debugserver-48[5590] <Warning>: 1 [15d6/1403]: error: ::read ( 6,0x3809f4,1024 ) => -1 err = Bad file descriptor (0x00000009) Sun Jul 11 00:03:43 Matts-iPhone com.apple.launchd[1] (UIKitApplication:com.mycom.myapp[0x3f60][5591]) <Notice>: (UIKitApplication:com.mycom.myapp[0x3f60]) Bug: launchd_core_logic.c:2688 (24132):10 Sun Jul 11 00:03:43 Matts-iPhone com.apple.launchd[1] (UIKitApplication:com.mycom.myapp[0x3f60][5591]) <Notice>: (UIKitApplication:com.mycom.myapp[0x3f60]) Working around 5020256. Assuming the job crashed. Sun Jul 11 00:03:43 Matts-iPhone com.apple.launchd[1] (UIKitApplication:com.mycom.myapp[0x3f60][5591]) <Warning>: (UIKitApplication:com.mycom.myapp[0x3f60]) Job appears to have crashed: Segmentation fault Sun Jul 11 00:03:43 Matts-iPhone SpringBoard[40] <Warning>: Application 'Phone' exited abnormally with signal 9: Killed Sun Jul 11 00:03:45 Matts-iPhone SpringBoard[40] <Warning>: Application 'myapp' exited abnormally with signal 11: Segmentation fault
但是,当我从手机启动应用程序(而不是通过Xcode)时,它按预期工作. (在发布期间有一个内存警告.我知道它运行正常,但它恢复并且不会崩溃).
这使得调试其他问题变得特别困难.
我偶然发现了一些iOS错误吗?
有任何想法吗?
在我的情况下,我忘记了我仍然有“NSZombiesEnabled”环境变量集,这从Xcode启动时增加了实际内存使用量(导致崩溃).直接从Springboard启动时,未设置该环境变量,并且应用程序使用的内存较少.
它对于调试非常有用……直到你的内存耗尽并忘记它在那里:)