2012-03-07 88 views
1

我正在使用RestKit並遇到問題。我已經嘗試了很多東西來解決這個問題,但沒有成功。 :)RestKit RKObjectLoader objectLoader didLoadObjects在設備上失敗

- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects { 
    NSLog(@"objects count: %d.", [objects count]); 
    NSLog(@"editions count: %d.", [editions count]); 
    [editions release]; 
    editions = [objects retain]; 
    NSLog(@"objects count: %d.", [objects count]); 
    NSLog(@"editions count: %d.", [editions count]); 
    Edition *edition = [objects objectAtIndex:0]; 
    NSLog(@"edition title: %@.", [edition title]); 
} 

上面代碼的控制檯是:

2012-03-07 18:02:58.477 AppName[2870:207] objects count: 1. 
2012-03-07 18:02:58.478 AppName[2870:207] editions count: 0. 
2012-03-07 18:02:58.479 AppName[2870:207] objects count: 1. 
2012-03-07 18:02:58.479 AppName[2870:207] editions count: 1. 
2012-03-07 18:02:58.480 AppName[2870:207] *** -[NSCFArray title]: unrecognized selector sent to instance 0x1ada60 
2012-03-07 18:02:58.481 AppName[2870:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFArray title]: unrecognized selector sent to instance 0x1ada60' 
2012-03-07 18:02:58.483 AppName[2870:207] Stack: (
    827948665, 
    859256445, 
    827961723, 
    827960065, 
    827553488, 
    13253, 
    166217, 
    827523067, 
    873795279, 
    827497493, 
    827495649, 
    865677531, 
    865677703, 
    806360113, 
    806353243, 
    10471, 
    10396 
) 
terminate called after throwing an instance of 'NSException' 
Program received signal: 「SIGABRT」. 
Program received signal: 「SIGABRT」. 

但是,它的工作原理在模擬器上:

2012-03-07 18:24:20.215 AppName[46315:207] objects count: 4. 
2012-03-07 18:24:20.215 AppName[46315:207] editions count: 0. 
2012-03-07 18:24:20.216 AppName[46315:207] objects count: 4. 
2012-03-07 18:24:20.216 AppName[46315:207] editions count: 4. 
2012-03-07 18:24:20.216 AppName[46315:207] edition title: Some String. 

請幫助..任何形式的答覆將不勝感激。謝謝。

ps:我也運行了RKTwitter示例。結果是一樣的!它在模擬器上很棒,但是在設備上產生了相同類型的錯誤。

pps:我已經嘗試了RKTwitter示例的主(Xcode4)和0.9穩定(Xcode3)分支。結果是一樣的。在模擬器上可以,但在設備上失敗。

回答

1

有同樣的問題在下面移植的10.7應用程序,什麼似乎發生的是它被包裹在第二陣列

(
(
    <ITEM> 
    <ITEM> 
    <ITEM> 
) 
) 

這只是發生在我的目標10.6壽我的NSArray *的對象。因此獲取真實對象就像查看數組的第一個索引是否爲索引然後使用它一樣簡單。我想它是一個錯誤/怪癖。或者我做錯了誰知道的事情。

+0

謝謝你的答案.. – siriusdely 2013-02-26 03:39:51

相關問題