在键盘显示时转动设备时iPhone应用程序崩溃

时间:2011-05-03 16:30:25

标签: iphone objective-c uiwebview keyboard crash

我有一个带有webview的iPhone应用程序,可以在某个时候重定向到论坛。

我注意到当我执行这些步骤时应用程序会崩溃:

1)浏览论坛(vBulletin)
2)打开一个帖子,尝试发帖子 3)单击textarea以显示键盘 4)然后快速键入和/或转动设备

现在我的iPhone应用程序崩溃了。注意:崩溃只出现在很长的线程中,所以它一定是内存或CPU的问题吗?

无论如何,我无法弄清楚在哪里搜索问题,因为XCode 4没有显示崩溃的任何日志!其次,当通过Xcode(在设备上)运行应用程序时,它崩溃而没有显示任何错误......崩溃不能通过模拟器重现(当然)。

如何解决这样的问题?


CONSOLE:

May 10 00:23:36 unknown SpringBoard[29] <Warning>: Received memory warning. Level=1
May 10 00:23:36 unknown MobilePhone[582] <Warning>: Received memory warning. Level=1
May 10 00:23:37 unknown configd[25] <Notice>: jetsam: kernel memory event (91), free: 1198, active: 7537, inactive: 3482, purgeable: 0, wired: 17615
May 10 00:23:37 unknown SpringBoard[29] <Warning>: Received memory warning. Level=2
May 10 00:23:37 unknown MobilePhone[582] <Warning>: Received memory warning. Level=2
May 10 00:23:38 unknown configd[25] <Notice>: jetsam: kernel termination snapshot being created
May 10 00:23:38 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.apple.mobilephone[0xa185]) Exited: Killed: 9
May 10 00:23:38 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.skype.skype[0xf18]) Exited: Killed: 9
May 10 00:23:38 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.myCompanygmbh.myTestApp[0x9c47]) Bug: launchd_core_logic.c:3795 (24506):0
May 10 00:23:39 unknown com.apple.debugserver-50[598] <Warning>: 1 [0256/1503]: error: ::read ( 4, 0x2ffb19f0, 1024 ) => -1 err = Bad file descriptor (0x00000009)
May 10 00:23:39 unknown SpringBoard[29] <Warning>: Application 'Phone' exited abnormally with signal 9: Killed: 9
May 10 00:23:39 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.myCompanygmbh.myTestApp[0x9c47]) Bug: launchd_core_logic.c:3794 (24506):3
May 10 00:23:39 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.myCompanygmbh.myTestApp[0x9c47]) Bug: launchd_core_logic.c:3202 (24506):10
May 10 00:23:39 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.myCompanygmbh.myTestApp[0x9c47]) Working around 5020256. Assuming the job crashed.
May 10 00:23:39 unknown com.apple.launchd[1] <Warning>: (UIKitApplication:com.myCompanygmbh.myTestApp[0x9c47]) Job appears to have crashed: Segmentation fault: 11
May 10 00:23:39 unknown SpringBoard[29] <Warning>: Application 'Skype' exited abnormally with signal 9: Killed: 9
May 10 00:23:39 unknown SpringBoard[29] <Warning>: Application 'myTestApp' exited abnormally with signal 11: Segmentation fault: 11
May 10 00:23:40 unknown kernel[0] <Debug>: launchd[606] Builtin profile: container (sandbox)
May 10 00:23:40 unknown kernel[0] <Debug>: launchd[606] Container: /private/var/mobile/Applications/1D182D9C-6475-4B81-B409-E6245C60FE84 [69] (sandbox)
May 10 00:23:40 unknown ReportCrash[604] <Error>: Saved crashreport to /Library/Logs/CrashReporter/LowMemory-2011-05-10-002340.plist using uid: 0 gid: 0, synthetic_euid: 0 egid: 0
May 10 00:23:41 unknown Skype[606] <Warning>: ===== Starting HellKit (10021/3.0.0.250/IPHONE) =====
May 10 00:23:41 unknown Skype[606] <Warning>: Running on iOS device model iPhone3,1 (sysctlbyname('hw.machine'))
May 10 00:23:41 unknown Skype[606] <Warning>: Video capture constraints: 12 FPS, complexity mode 8
May 10 00:23:42 unknown MobilePhone[605] <Warning>: UI Mode is Phone
May 10 00:23:43 unknown SpringBoard[29] <Debug>: spd:___libspd_initialize_notify_block_invoke_1:214 spd woke up!
May 10 00:23:43 unknown SpringBoard[29] <Debug>: spd:_libspd_initialize_protocol:142 Registered notification port with spd [PID=609]
May 10 00:23:43 unknown SpringBoard[29] <Debug>: spd:spd_notification_socket_activity:279 Calling session client's callback on their queue for client [PID=606]
May 10 00:23:44 unknown sandboxd[610] <Notice>: Skype(606) deny file-write-create /Applications/.dat025e.000
May 10 00:23:44 unknown mediaserverd[19] <Warning>: 00:23:44.479 <SystemSoundServer> WARNING translating CMSession error: -12985 
May 10 00:23:44 unknown mediaserverd[19] <Warning>: 00:23:44.530 <SystemSoundServer> WARNING translating CMSession error: -12985 
May 10 00:23:44 unknown spd[609] <Error>: spd:spd_vet_socket:658 getpeername failure for client socket [FD=5]: Socket is not connected
May 10 00:23:44 unknown spd[609] <Error>: spd:spd_checkin_socket:954 Unable to check-in unsupported socket for client [PID=606]
May 10 00:23:44 unknown mediaserverd[19] <Error>: 00:23:44.585 <AudioQueueServer> AudioQueue: Error -12985 from AudioSessionSetClientPlayState(606)
May 10 00:23:45 unknown spd[609] <Error>: spd:spd_vet_socket:658 getpeername failure for client socket [FD=6]: Socket is not connected
May 10 00:23:45 unknown spd[609] <Error>: spd:spd_checkin_socket:954 Unable to check-in unsupported socket for client [PID=606]

1 个答案:

答案 0 :(得分:2)

我曾经有类似的问题,这是一个可能的解决方案......

首先,它很可能是内存问题,而不是CPU使用率,因此请确保在应用程序委托上实现- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application委托方法...在那里放置一个日志行。

其次,模拟低内存警告(模拟器在硬件菜单中有该选项)

现在观察您的应用程序是否在从线程到线程时崩溃(我怀疑它会)。

如果它确实崩溃了,那么在调试器中通过你的ivars崩溃(特别是那些与UI组件相对应并从xib加载的)。确保它们引用了它们应该引用的内容:当您的应用收到内存不足警告时,iOS会自动卸载隐藏视图的xib资源,如果您在代码中某处保持/依赖它们中的任何一个,则很可能是如果这些ivars不是您的代码所期望的,那么app会崩溃。

最后的建议:下次遇到崩溃时,请确保包含堆栈跟踪。如果您没有在调试模式下运行应用程序,您仍然可以使用可以读取设备控制台输出的“iPhone配置实用程序”来获取堆栈跟踪