2013-01-09 79 views
0

我更新一個遊戲,我有Mac和通過的XCode運行時的更新工作正常。的Cocos2D 2 OSX EXC_BAD_ACCESS(SIGSEGV)

我試圖通過開發者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 

回答

1

從頭開始的。

在這條線盯着小時後:

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

我意識到,代碼包括了一個循環,我無法弄清楚什麼是錯的吧!所以最後我忘了在for循環開始時初始化int i。

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

    } 

所以對於這麼簡單的東西導致崩潰的Xcode外面但是不會驅使我瘋了!

感謝您的閱讀!

+0

未初始化變量包含隨機值。它可能只是在你的機器上工作,而不在你朋友的機器上工作。 – LearnCocos2D

+0

很多次,「調試版本」將初始化變量爲零你,所以它可能是有幫助的,然後再上傳到運行發佈版本。 這方面的一些信息是在這裏: http://meandmark.com/blog/2011/03/xcode-4-setting-the-active-build-configuration/ – SteveS

相關問題