0

我正在更新我为 Mac 拥有的游戏,并且在通过 XCode 运行时更新工作正常。

我尝试通过开发人员 ID 签名的应用程序进行分发,这样我就可以让朋友测试它,当我运行应用程序并向他们提供应用程序时,它会在主菜单之后崩溃。我是不是导出错了?为什么它会通过 XCode 运行良好,然后我尝试导出它并且每次都崩溃?

这是我的错误日志:


   Crashed Thread:  6  CVDisplayLink 

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000121028021

VM Regions Near 0x121028021:
CG shared images       000000011f294000-000000011f29c000 [   32K] r--/r-- SM=SHM  
--> 
CG shared images       00000001c0001000-00000001c0009000 [   32K] rw-/rw- SM=SHM  

Thread 0:: Dispatch queue: com.apple.main-thread
    0   libsystem_kernel.dylib          0x00007fff91ef6686 mach_msg_trap + 10
    1   libsystem_kernel.dylib          0x00007fff91ef5c42 mach_msg + 70
    2   com.apple.CoreFoundation        0x00007fff8bf01803 __CFRunLoopServiceMachPort + 195
    3   com.apple.CoreFoundation        0x00007fff8bf06ee6 __CFRunLoopRun + 1078
    4   com.apple.CoreFoundation        0x00007fff8bf066b2 CFRunLoopRunSpecific + 290
    5   com.apple.HIToolbox             0x00007fff943620a4 RunCurrentEventLoopInMode + 209
    6   com.apple.HIToolbox             0x00007fff94361e42 ReceiveNextEventCommon + 356
    7   com.apple.HIToolbox             0x00007fff94361cd3 BlockUntilNextEventMatchingListInMode + 62
    8   com.apple.AppKit                0x00007fff961c8613 _DPSNextEvent + 685
    9   com.apple.AppKit                0x00007fff961c7ed2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
    10  com.apple.AppKit                0x00007fff961bf283 -[NSApplication run] + 517
    11  com.apple.AppKit                0x00007fff96163cb6 NSApplicationMain + 869
    12  libdyld.dylib                   0x00007fff916837e1 start + 1

    Thread 1:
    0   libsystem_kernel.dylib          0x00007fff91ef86d6 __workq_kernreturn + 10
    1   libsystem_c.dylib               0x00007fff8ce15eec _pthread_workq_return + 25
    2   libsystem_c.dylib               0x00007fff8ce15cb3 _pthread_wqthread + 412
    3   libsystem_c.dylib               0x00007fff8ce00171 start_wqthread + 13

    Thread 2:: Dispatch queue: com.apple.libdispatch-manager
    0   libsystem_kernel.dylib          0x00007fff91ef8d16 kevent + 10
    1   libdispatch.dylib               0x00007fff91fbfdea _dispatch_mgr_invoke + 883
    2   libdispatch.dylib               0x00007fff91fbf9ee _dispatch_mgr_thread + 54

    Thread 3:
    0   libsystem_kernel.dylib          0x00007fff91ef86d6 __workq_kernreturn + 10
    1   libsystem_c.dylib               0x00007fff8ce15eec _pthread_workq_return + 25
    2   libsystem_c.dylib               0x00007fff8ce15cb3 _pthread_wqthread + 412
    3   libsystem_c.dylib               0x00007fff8ce00171 start_wqthread + 13

    Thread 4:
    0   libsystem_kernel.dylib          0x00007fff91ef86d6 __workq_kernreturn + 10
    1   libsystem_c.dylib               0x00007fff8ce15eec _pthread_workq_return + 25
    2   libsystem_c.dylib               0x00007fff8ce15cb3 _pthread_wqthread + 412
    3   libsystem_c.dylib               0x00007fff8ce00171 start_wqthread + 13

    Thread 5:
    0   libsystem_kernel.dylib          0x00007fff91ef86d6 __workq_kernreturn + 10
    1   libsystem_c.dylib               0x00007fff8ce15eec _pthread_workq_return + 25
    2   libsystem_c.dylib               0x00007fff8ce15cb3 _pthread_wqthread + 412
    3   libsystem_c.dylib               0x00007fff8ce00171 start_wqthread + 13

    Thread 6 Crashed:: CVDisplayLink
    0   com.lasthaven.wordshufflemac    0x000000010bacc52a -[GameScene scrambleWord:] + 158 (GameScene.m:322)
    1   com.lasthaven.wordshufflemac    0x000000010baced36 -[GameScene setupNewWord] + 373 (GameScene.m:878)
    2   com.lasthaven.wordshufflemac    0x000000010bacb6c1 -[GameScene initializeGame] + 941 (GameScene.m:112)
    3   com.lasthaven.wordshufflemac    0x000000010bacb2fc -[GameScene init] + 428 (GameScene.m:56)
    4   com.lasthaven.wordshufflemac    0x000000010baf30c1 +[CCNode node] + 33
    5   com.lasthaven.wordshufflemac    0x000000010bacb11b +[GameScene scene] + 62 (GameScene.m:32)
    6   com.lasthaven.wordshufflemac    0x000000010bac9f90 -[MenuScene playGame:] + 363 (MenuScene.m:301)
    7   com.lasthaven.wordshufflemac    0x000000010baee7e3 -[CCMenu ccMouseUp:] + 112
    8   com.lasthaven.wordshufflemac    0x000000010bb177fb -[CCEventDispatcher mouseUp:] + 101
    9   com.apple.Foundation            0x00007fff97fa5220 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 212
    10  com.apple.Foundation            0x00007fff97fdf8b9 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:] + 122
    11  com.lasthaven.wordshufflemac    0x000000010bb17f25 -[CCEventDispatcher dispatchEvent:] + 140
    12  com.apple.Foundation            0x00007fff97fab677 __NSThreadPerformPerform + 225
    13  com.apple.CoreFoundation        0x00007fff8bee4101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    14  com.apple.CoreFoundation        0x00007fff8bee3a25 __CFRunLoopDoSources0 + 245
    15  com.apple.CoreFoundation        0x00007fff8bf06dc5 __CFRunLoopRun + 789
    16  com.apple.CoreFoundation        0x00007fff8bf066b2 CFRunLoopRunSpecific + 290
    17  com.apple.Foundation            0x00007fff97fb389e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 268
    18  com.lasthaven.wordshufflemac    0x000000010bb16888 -[CCDirectorDisplayLink getFrameForTime:] + 162
    19  com.apple.CoreVideo             0x00007fff8c0c603d CVDisplayLink::performIO(CVTimeStamp*) + 203
    20  com.apple.CoreVideo             0x00007fff8c0c52a4 CVDisplayLink::runIOThread() + 632
    21  com.apple.CoreVideo             0x00007fff8c0c5013 startIOThread(void*) + 148
    22  libsystem_c.dylib               0x00007fff8ce13742 _pthread_start + 327
    23  libsystem_c.dylib               0x00007fff8ce00181 thread_start + 13

4

1 回答 1

1

从头开始。

盯着这条线几个小时后:

0   com.lasthaven.wordshufflemac    0x000000010bacc52a -[GameScene scrambleWord:] + 158 (GameScene.m:322)

我意识到代码由一个 for 循环组成,我无法弄清楚它有什么问题!所以最后我忘了在 for 循环的开头初始化 int i 。

 for(int i = 0; i < [word length]; i++ {

  }

因此,对于如此简单的事情,它会在 XCode 之外导致崩溃,但不会在其中导致崩溃,这让我发疯了!

谢谢阅读!

于 2013-01-09T22:03:17.510 回答