应用程序在4分钟后崩溃

时间:2011-01-16 19:17:05

标签: iphone crash arc4random

我在arc4random调用期间遇到一个奇怪的崩溃,只有在应用程序运行大约4分钟后才出现,并且每次都不会这样做。这是崩溃日志:

Incident Identifier: 25C8C57F-0434-40B2-A2E8-FE88F58ABF60
CrashReporter Key:   8683ce910e9db4ba69f61266b606396f941d08ee
Hardware Model:      iPhone2,1
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2011-01-16 18:46:45.170 +0000
OS Version:      iPhone OS 4.2.1 (8C148a)
Report Version:  104

Exception Type:  00000020
Exception Codes: 0x8badf00d
Highlighted Thread:  0

Application Specific Information:
<App> failed to resume in time

Elapsed total CPU time (seconds): 5.930 (user 5.380, system 0.550), 100% CPU 
Elapsed application CPU time (seconds): 4.790, 81% CPU

Thread 0:
0   libSystem.B.dylib              0x31168006 pthread_mutex_lock + 50
1   libSystem.B.dylib              0x3118cb10 arc4random + 24
2   <App>                   0x0000f658 -[BasicGameLayer updateBoard] (BasicGameScreen.mm:318)
3   <App>                    0x00010790 -[BasicGameLayer handleTouches:withEvent:] (BasicGameScreen.mm:238)
4   <App>                   0x0000e504 -[BasicGameLayer ccTouchesBegan:withEvent:] (BasicGameScreen.mm:276)

BasicGameScreen.mm的第318行是一个左大括号。我假设编译器正在删除空格,所以我认为它崩溃的行是

int selection = arc4random() % 16;

2 个答案:

答案 0 :(得分:4)

线索在这里:

  

异常代码:0x8badf00d

这意味着你在启动时所做的事情需要很长时间才能完成执行。

答案 1 :(得分:0)

事实证明,这是一个无限循环(在我的代码中),是在一个非常特定的变量组合下触发的。

相关问题