iPhone应用程序崩溃时,当键盘显示时转动设备 [英] iPhone app crashing when turning device while keyboard is showing

查看:327
本文介绍了iPhone应用程序崩溃时,当键盘显示时转动设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



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

p>

1)浏览论坛(vBulletin)

2)打开一个帖子并尝试发布消息

3)点击进入textarea,键盘显示
4)然后键入和/或快速转动设备



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



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



如何解决这个问题?






CONSOLE:

  5月10日00:23:36未知SpringBoard [29]<警告>:接收到内存警告。级别= 1 
5月10日00:23:36未知手机[582]<警告>:接收到内存警告。 level = 1
May 10 00:23:37 unknown configd [25]<注意> ;:jetsam:内核内存事件(91),free:1198,active:7537,inactive:3482,purgeable:0,wired :17615
5月10日00:23:37未知SpringBoard [29]<警告>:接收到内存警告。级别= 2
5月10日00:23:37未知手机[582]<警告>:接收到内存警告。 level = 2
May 10 00:23:38 unknown configd [25]<注意>:jetsam:正在创建内核终止快照
May 10 00:23:38 unknown com.apple.launchd [1 ]<注意> ;:(UIKitApplication:com.apple.mobilephone [0xa185])退出:Killed:9
May 10 00:23:38 unknown com.apple.launchd [1] :com.skype.skype [0xf18])退出:Killed:9
5月10日00:23:38未知com.apple.launchd [1]<注意> ;:(UIKitApplication:com.myCompanygmbh.myTestApp [0x9c47 ]错误:launchd_core_logic.c:3795(24506):0
5月10日00:23:39未知com.apple.debugserver-50 [598]<警告>:1 [0256/1503]:错误: :: read(4,0x2ffb19f0,1024)=> -1错误=错误的文件描述符(0x00000009)
5月10 00:23:39未知SpringBoard [29]<警告>:应用程序'电话'异常退出信号9:Killed:9
5月10日00:23:39未知com.apple.launchd [1]<注意> ;:(UIKitApplication:com.myCompanygmbh.myTestApp [0x9c47])错误:launchd_core_logic.c:3794(24506):3
5月10 00 :23:39 unknown com.apple.launchd [1]<注意> ;:(UIKitApplication:com.myCompanygmbh.myTestApp [0x9c47])Bug:launchd_core_logic.c:3202(24506):10
5月10日00: 23:39未知com.apple.launchd [1]<注意> ;:(UIKitApplication:com.myCompanygmbh.myTestApp [0x9c47])解决5020256.假设作业崩溃。
5月10 00:23:39未知com.apple.launchd [1]<警告> ;:(UIKitApplication:com.myCompanygmbh.myTestApp [0x9c47])作业似乎已崩溃:分段错误:11
5月10日00:23:39未知SpringBoard [29]<警告> ;:应用程序'Skype'异常退出信号9:Killed:9
5月10 00:23:39未知SpringBoard [29]< ;:应用程序'myTestApp'异常退出信号11:分段故障:11
5月10日00:23:40未知内核[0]< Debug> ;: launchd [606]内置配置文件:容器$ b May 10 00:23:40未知内核[0]< Debug> ;: launchd [606] Container:/ private / var / mobile / Applications / 1D182D9C-6475-4B81-B409-E6245C60FE84 [sandbox]
5月10 00:23:40未知ReportCrash [604]<错误> ;:保存crashreport到/Library/Logs/CrashReporter/LowMemory-2011-05-10-002340.plist使用uid:0 gid:0,synthetic_euid :0 egid:0
May 10 00:23:41未知Skype [606]< Warning> ;: =====启动HellKit(10021 / 3.0.0.250 / IPHONE)=====
5月10日00:23:41未知Skype [606]<警告> ;:在iOS设备上运行iPhone3,1(sysctlbyname('hw.machine'))
5月10日00:23:41未知Skype [ 606]<警告> ;:视频捕获约束:12 FPS,复杂模式8
5月10日00:23:42未知移动电话[605]<警告>:UI模式是电话
5月10日00: 23:43未知SpringBoard [29]< Debug> ;: spd:___ libspd_initialize_notify_block_invoke_1:214 spd唤醒!
May 10 00:23:43未知SpringBoard [29]< Debug> ;: spd:_libspd_initialize_protocol:142注册通知端口与spd [PID = 609]
5月10 00:23:43未知SpringBoard [ 29]< Debug> ;:spd:spd_notification_socket_activity:279在客户端的队列上调用会话客户端回调[PID = 606]
5月10 00:23:44未知sandboxd [610]< )deny file-write-create /Applications/.dat025e.000
May 10 00:23:44 unknown mediaserverd [19]< Warning> ;: 00:23:44.479< SystemSoundServer>警告翻译CMSession错误:-12985
5月10日00:23:44未知mediaserverd [19]<警告> ;: 00:23:44.530< SystemSoundServer>警告翻译CMSession错误:-12985
5月10日00:23:44未知的spd [609]<错误> ;: spd:spd_vet_socket:658客户端套接字的getpeername失败[FD = 5]:套接字未连接
May 10 00:23:44 unknown spd [609]<错误> ;: spd:spd_checkin_socket:954无法为客户端签入不支持的套接字[PID = 606]
May 10 00:23:44 unknown mediaserverd [19]< Error> ;: 00:23:44.585< AudioQueueServer> AudioQueue:Error -12985来自AudioSessionSetClientPlayState(606)
5月10日00:23:45未知spd [609]<错误> ;: spd:spd_vet_socket:658客户端套接字的getpeername失败[FD = 6]:套接字不connected
May 10 00:23:45 unknown spd [609]<错误> ;: spd:spd_checkin_socket:954无法为客户端签入不支持的套接字[PID = 606]


解决方案

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

首先,首先,它很可能是一个内存问题,而不是CPU使用,所以确保你实现 - (void)applicationDidReceiveMemoryWarning:(UIApplication * )application delegate方法在你的应用程序委托...放一个日志行。



其次,模拟低内存警告



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



如果它崩溃,那么在调试器中,通过你的ivars它崩溃(尤其是对应于UI组件和从xib加载)。确保他们引用他们应该参考:当你的应用程序收到低内存警告,iOS将自动卸载隐藏视图的xib资源,如果你保持/依赖于他们在代码中的某个地方,可能是应用程序将崩溃,如果这些ivars不是你的代码所期望的。



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


I have an iPhone app with a webview that redirects to a forum at some point.

I noticed that the app will crash when I do these steps:

1) Browse through the forum (vBulletin)
2) Open a thread and try to post a message
3) Click into the textarea so the keyboard shows up 4) Then type and/or turn the device quickly

Now my iPhone app crashes. Notice: the crash only appears in very long threads, so it must be some problem of memory or CPU?

Anyway, I can't figure out where to search for the problem, because XCode 4 isn't showing any logs for the crash! Secondly, when running the app via Xcode (on the device) it crashes without showing any error... The crash isn't reproducible via Simulator (of course).

How to solve such a problem?


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]

解决方案

I've had a similar issue once and here's a possible solution...

First things first, it's very likely to be a memory issue and not the CPU usage, so make sure you implement the - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application delegate method on your app delegate... put a log line there.

Secondly, emulate the low memory warning (simulator has that option in the hardware menu)

Now observe if your app crashes while going from thread to thread (I suspect it will).

If it does crash, then in debugger go through your ivars where it crashes (especially those that correspond to UI components and are loaded from the xib). Make sure they reference what they are supposed to reference: when your app receives a low memory warning, iOS will automatically unload xib resources of hidden views, and if you hold on/depend on any of them somewhere in your code, it's likely that the app will crash if those ivars are not what your code expects.

And the final recommendation: next time you get a crash make sure to include the stack trace. If you don't have the app running in debug mode, you still can get the stack trace by using the "iPhone Configuration Utility" which can read the console output of your device

这篇关于iPhone应用程序崩溃时,当键盘显示时转动设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆