2012-09-09 51 views
0

我有我的當前iPhone應用程序的崩潰日誌是象徵性的,但我無法破譯問題仍然存在。GameCenter功能崩潰的應用程序 - 任何人都可以幫助解決?

基本問題是,在某些設備(特別是較舊的設備)我的應用程序崩潰回到主屏幕。這似乎是用戶在一段時間後回到我的遊戲 - 這啓動了遊戲中心的登錄過程。我已經粘貼下面的崩潰日誌的相關部分:

Exception Type: EXC_BAD_ACCESS (SIGSEGV) 
Exception Codes: KERN_INVALID_ADDRESS at 0x2e000000 
Crashed Thread: 0 

Thread 0 name: Dispatch queue: com.apple.main-thread 
Thread 0 Crashed: 
0 libobjc.A.dylib     0x37c11f7e objc_msgSend + 22 
1 Transfer Quiz     0x000023c4 -[GameCenterManager callDelegate:withArg:error:] (GameCenterManager.m:113) 
2 Transfer Quiz     0x0000230c __60-[GameCenterManager callDelegateOnMainThread:withArg:error:]_block_invoke_0 (GameCenterManager.m:103) 
3 libdispatch.dylib    0x346fdc52 _dispatch_call_block_and_release + 6 
4 libdispatch.dylib    0x346ffee0 _dispatch_main_queue_callback_4CF$VARIANT$mp + 188 
5 CoreFoundation     0x358432a6 __CFRunLoopRun + 1262 
6 CoreFoundation     0x357c649e CFRunLoopRunSpecific + 294 
7 CoreFoundation     0x357c6366 CFRunLoopRunInMode + 98 
8 GraphicsServices    0x37462432 GSEventRunModal + 130 
9 UIKit       0x332d2cce UIApplicationMain + 1074 
10 Transfer Quiz     0x000030d4 main (main.m:16) 
11 Transfer Quiz     0x000021a8 start + 32 

這裏是GameCenterManager callDelegate下面的代碼:

- (void) callDelegate: (SEL) selector withArg: (id) arg error: (NSError*) err 
{ 
assert([NSThread isMainThread]); 
if([delegate respondsToSelector: selector]) 
{ 
    if(arg != NULL) 
    { 
     [delegate performSelector: selector withObject: arg withObject: err]; 
    } 
    else 
    { 
     [delegate performSelector: selector withObject: err]; 
    } 
} 
else 
{ 
    NSLog(@"Missed Method"); 
} 
} 

的代碼是在外部教程網站教程的一部分 - 我無法確定導致我的應用程序崩潰的問題。

有沒有人知道代碼導致崩潰的原因?任何幫助將非常感激。我發現很難複製任何設備上的崩潰,並且使用NSZombies也可能是因爲我無法重新創建崩潰。

謝謝大家,提前。

回答

0

看來你正在調用的選擇器需要2個參數:'arg'和'error'。現在的事情是,如果'arg'是零,你只需要調用一個參數 - 所以第二個參數基本上是垃圾,當選擇器被調用的對象試圖訪問第二個參數時,它崩潰。總而言之,您並不需要if() - 總是將兩個參數傳遞給選擇器,並讓委託檢測它的第一個參數是否爲零。

+0

我當然會試一試 - 謝謝你的評論 - 很難確定這個實際工作是否需要幾次嘗試,但是當我找到時我會回覆你的! – user1309044

+0

@ user1309044相信我,它*是*的問題。 – 2012-09-09 19:55:05

相關問題