我會在這個可變數組中放置各種各樣的東西,但首先我只是試圖通過放入字符串,然後拔出字符串來確保它的工作。這裏是我的代碼無法正確地從NSMutableArray檢索對象
[email protected]"1";
[email protected]"2";
[email protected]"3";
NSMutableArray *testArray;
[testArray addObject:str1];
[testArray addObject:str2];
[testArray addObject:str3];
retrieve =[testArray objectAtIndex:1];
NSLog(@"the test number is %@",retrieve);
問題是,我的字符串︰檢索後收到數組中的字符串「null」。我不確定我做錯了什麼,我看過蘋果的文檔,但是我很難理解它。我知道我必須錯誤地與數組交互,但我不確定具體是什麼。幫助將不勝感激。 - 謝謝!
testArray = [NSMutableArray中新]? – EDUsta 2014-11-20 18:43:25
非常感謝!修復它。謝謝EDUsta! – 2014-11-20 18:44:56