应用程序适用于iPhone模拟器,但在真正的iPhone设备上崩溃

时间:2012-09-14 00:47:33

标签: objective-c cocos2d-iphone

今天我尝试在我的iPhone设备上运行我的应用程序,它崩溃了!它在模拟器上工作得非常好,我不知道问题是什么。

这些是崩溃日志:

Identifier:      Evader
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2012-09-13 16:41:54.656 -0700
OS Version:      iPhone OS 5.1.1 (9B206)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x377d888f __exceptionPreprocess + 163
1   libobjc.A.dylib                 0x354dd259 objc_exception_throw + 33
2   CoreFoundation                  0x377d8789 +[NSException raise:format:] + 1
3   Foundation                      0x380173a3 -[NSAssertionHandler                         handleFailureInMethod:object:file:lineNumber:description:] + 91
4   Evader                          0x0012ca41 -[CCSprite initWithTexture:] (CCSprite.m:192)
5   Evader                          0x0012c1b1 +[CCSprite spriteWithTexture:] (CCSprite.m:83)
6   Evader                          0x0011eb3d -[CCProgressTimer initWithTexture:] (CCProgressTimer.m:69)
7   Evader                          0x0011ea55 -[CCProgressTimer initWithFile:] (CCProgressTimer.m:59)
8   Evader                          0x0011e9e1 +[CCProgressTimer progressWithFile:] (CCProgressTimer.m:55)
9   Evader                          0x00173579 -[HelloWorldLayer lives] (HelloWorldLayer.m:256)
10  Evader                          0x001723ed -[HelloWorldLayer init] (HelloWorldLayer.m:101)
11  Evader                          0x0010f073 +[CCNode node] (CCNode.m:258)
12  Evader                          0x0017bd11 -[StartMenu doThis:] (StartMenu.m:75)
13  CoreFoundation                  0x377db7e4 __invoking___ + 68
14  CoreFoundation                  0x377367b1 -[NSInvocation invoke] + 161
15  Evader                          0x0010aa03 -[CCMenuItem activate] (CCMenuItem.m:129)
16  Evader                          0x001085ff -[CCMenu ccTouchEnded:withEvent:] (CCMenu.m:198)
17  CoreFoundation                  0x377323fd -[NSObject performSelector:withObject:withObject:] + 53
18  Evader                          0x0014f4ff -[CCTouchDispatcher touches:withEvent:withTouchType:] (CCTouchDispatcher.m:268)
19  Evader                          0x0014fc43 -[CCTouchDispatcher touchesEnded:withEvent:] (CCTouchDispatcher.m:338)
20  Evader                          0x001515c3 -[EAGLView touchesEnded:withEvent:] (EAGLView.m:332)
21  UIKit                           0x314c692b -[UIWindow _sendTouchesForEvent:] + 319
22  UIKit                           0x314c6319 -[UIWindow sendEvent:] + 381
23  UIKit                           0x314ac695 -[UIApplication sendEvent:] + 357
24  UIKit                           0x314abf3b _UIApplicationHandleEvent + 5827
25  GraphicsServices                0x33eee22b PurpleEventCallback + 883
26  CoreFoundation                  0x377ac523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 39
27  CoreFoundation                  0x377ac4c5 __CFRunLoopDoSource1 + 141
28  CoreFoundation                  0x377ab313 __CFRunLoopRun + 1371
29  CoreFoundation                  0x3772e4a5 CFRunLoopRunSpecific + 301
30  CoreFoundation                  0x3772e36d CFRunLoopRunInMode + 105
31  GraphicsServices                0x33eed439 GSEventRunModal + 137
32  UIKit                           0x314dacd5 UIApplicationMain + 1081
33  Evader                          0x00171029 main (main.m:14)
34  Evader                          0x000dec68 start + 40


Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x3198f32c __pthread_kill + 8
1   libsystem_c.dylib               0x3408c208 pthread_kill + 48
2   libsystem_c.dylib               0x34085298 abort + 88
3   libc++abi.dylib                 0x36f12f64 abort_message + 40
4   libc++abi.dylib                 0x36f10346 _ZL17default_terminatev + 18
5   libobjc.A.dylib                 0x354dd350 _objc_terminate + 140
6   libc++abi.dylib                 0x36f103be _ZL19safe_handler_callerPFvvE + 70
7   libc++abi.dylib                 0x36f1044a std::terminate() + 14
8   libc++abi.dylib                 0x36f1181e __cxa_rethrow + 82
9   libobjc.A.dylib                 0x354dd2a2 objc_exception_rethrow + 6
10  CoreFoundation                  0x3772e506 CFRunLoopRunSpecific + 398
11  CoreFoundation                  0x3772e366 CFRunLoopRunInMode + 98
12  GraphicsServices                0x33eed432 GSEventRunModal + 130
13  UIKit                           0x314dacce UIApplicationMain + 1074
14  Evader                          0x00171022 main (main.m:14)
15  Evader                          0x000dec60 start + 32

我试图寻找错误,但我不知道该寻找什么。有人可以帮助解决这个问题吗?

1 个答案:

答案 0 :(得分:4)

CCSprite initWithTexture:会引发导致您的应用退出的异常。我并不完全了解Cocos2d,但是快速检查文档表明它会因未能找到命名文件而引发异常。

在这种情况下,我猜这个问题只是文件名之一。默认情况下,Mac不区分大小写。所以,如果你有FunnyImage.png,那么如果你试图加载funnyimage.png,模拟器就会成功。

iOS设备区分大小写。因此,如果您尝试加载funnyimage.png,它将失败。

所以你想要做的就是检查你在代码中使用的所有文件名是否与实际文件的大小写完全匹配。