我想要使用此代碼,我在這個崗位發現的NSArray轉換爲NSDictionary中: Convert NSArray to NSDictionary轉換NSArray的NSDictionary的到 - 錯誤
@implementation NSArray (indexKeyedDictionaryExtension)
- (NSDictionary *)indexKeyedDictionary
{
NSUInteger arrayCount = [self count];
id arrayObjects[arrayCount], objectKeys[arrayCount];
[self getObjects:arrayObjects range:NSMakeRange(0UL, arrayCount)];
for(NSUInteger index = 0UL; index < arrayCount; index++) { objectKeys[index] = [NSNumber numberWithUnsignedInteger:index]; }
return([NSDictionary dictionaryWithObjects:arrayObjects forKeys:objectKeys count:arrayCount]);
}
@end
但是存在[自獲得對象的行錯誤:數組對象,...],並帶消息:發送「NSString _strong到_unsafe_unretained id *類型的參數」更改指針的保留/釋放屬性。我想這是因爲ARC的問題,因爲該職位是在2009年 任何人都知道如何擺脫這個問題感謝..
什麼是[self count]?自我?通過NSLog在控制檯中顯示它?和http://stackoverflow.com/questions/12868603/sending-nsstring-strongto-parameter-of-type-unsafe-unretained-id-change-r – 2013-08-19 04:34:53
http://pastebin.com/YWYbStxK – 2013-08-19 04:43:17
什麼是創造無論如何,密鑰只是索引的字典?沒有我能看到的。 – trojanfoe