iOS App不会死机,退出后写入控制台并播放声音
<p><p>我的应用存在某种僵尸问题。 (不是 NSZombie 问题。就像是死而复生的问题。)</p>
<p>我首先注意到,在调试 session 之后,当我去运行时,iPhone 上的音乐会每隔约 7 分钟暂停一次,当我解锁设备时,应用名称会在状态栏中闪烁红色就好像它刚刚坠毁一样。有时应用程序甚至会发出幻音,就像它仍在后台运行一样。</p>
<p>手动退出应用,继续。 <strong>即使该应用不再出现在我正在运行的应用列表中,仍然会出现间歇性音频伪影。</strong></p>
<p>当我重新插入时,每次应用程序僵尸化并自行重新启动时,它都会出现在控制台中。它看起来就像应用程序的正常启动!什么?什么会触发我的应用自行重启?</p>
<p>控制台:</p>
<pre><code>Apr 26 12:10:01 unknown Breakout <Warning>: cocos2d: cocos2d v1.1.0-beta2b
Apr 26 12:10:01 unknown Breakout <Warning>: cocos2d: Using Director Type:CCDirectorDisplayLink
Apr 26 12:10:01 unknown Breakout <Warning>: cocos2d: OS version: 5.1 (0x05010000)
Apr 26 12:10:01 unknown Breakout <Warning>: cocos2d: GL_VENDOR: Imagination Technologies
Apr 26 12:10:01 unknown Breakout <Warning>: cocos2d: GL_RENDERER: PowerVR SGX 535
Apr 26 12:10:01 unknown Breakout <Warning>: cocos2d: GL_VERSION:OpenGL ES-CM 1.1 IMGSGX535-63.24
Apr 26 12:10:01 unknown Breakout <Warning>: cocos2d: GL_MAX_TEXTURE_SIZE: 2048
Apr 26 12:10:01 unknown Breakout <Warning>: cocos2d: GL_MAX_MODELVIEW_STACK_DEPTH: 16
// etc //
Apr 26 12:10:01 unknown kernel <Debug>: launchd Builtin profile: container (sandbox)
Apr 26 12:10:01 unknown kernel <Debug>: launchd Container: /private/var/mobile/Applications/FFEB0A26-06D1-4C46-8AE5-C60582D09A1D (sandbox)
Apr 26 12:10:01 unknown Breakout <Warning>: Audio session details
Apr 26 12:10:01 unknown Breakout <Warning>: Audio Input Available? YES
Apr 26 12:10:01 unknown mediaserverd <Warning>: 12:10:01.641 <SystemSoundServer> WARNING translating HAL error: 561214578
Apr 26 12:10:01 unknown Breakout <Warning>: Max Possible Inputs 15151420
Apr 26 12:10:01 unknown Breakout <Warning>: Outputs 2
Apr 26 12:10:01 unknown Breakout <Warning>: Device sample rate 44100.000000
Apr 26 12:10:01 unknown Breakout <Warning>: Hardware buffer size 0.023220
// etc //
Apr 26 12:10:33 unknown SpringBoard <Notice>: Posting 'com.apple.iokit.hid.displayStatus' notifyState=1
Apr 26 12:10:33 unknown UserEventAgent <Warning>: DEBUG: Changing screen blanked state: 0
Apr 26 12:10:33 unknown SpringBoard <Notice>: MultitouchHID: detection mode: 255->0 (deferring until bootloaded)
Apr 26 12:10:33 unknown SpringBoard <Notice>: MultitouchHID: device bootloaded
Apr 26 12:10:33 unknown SpringBoard <Notice>: MultitouchHID: detection mode: 0->0
Apr 26 12:10:34 unknown kernel <Debug>: set_crc_notification_state 0
Apr 26 12:10:34 unknown ReportCrash <Notice>: Formulating crash report for process Breakout
>
Apr 26 12:10:34 unknown SpringBoard <Warning>: pid_suspend failed for : Unknown error: -1, Unknown error: -1
Apr 26 12:10:34 unknown SpringBoard <Warning>: Could not set priority of to 4096, priority: No such process
Apr 26 12:10:34 unknown com.apple.launchd <Warning>: (UIKitApplication:com.charliewilliams.Breakout) Job appears to have crashed: Trace/BPT trap: 5
Apr 26 12:10:34 unknown SpringBoard <Warning>: Application 'Breakout' exited abnormally with signal 5: Trace/BPT trap: 5
Apr 26 12:10:35 unknown ReportCrash <Error>: libMobileGestalt computeUniqueDeviceID: total time for bb to return imei: 0
Apr 26 12:10:35 unknown ReportCrash <Notice>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/Breakout_2012-04-26-121033_Tortuga-Gigante.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0
</code></pre>
<p><strong>解决方案说明</strong>:结果很简单 - 1. 我在 <code>dealloc</code> 中关闭了我的 Audio Session ,但在 <code>applicationDidEnterBackground</code> 中没有>。而且由于我使用的是 <code>kaudiosessioncategory_playandrecord</code>,这似乎告诉 iOS 如果应用程序在后台崩溃,则重新启动它。</p>
<p>现在,为什么它会在后台崩溃? ...嗯,这是我的下一个任务。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>应用程序可能设置了后台 voip 标志。如果是这样,如果应用程序异常退出(或设备重启时),操作系统将重新启动应用程序。</p></p>
<p style="font-size: 20px;">关于iOS App不会死机,退出后写入控制台并播放声音,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/10332422/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/10332422/
</a>
</p>
页:
[1]