1
後加入,我有以下代碼iphone:addObjectsFromArray不重新初始化nsmutable陣列
inAppKeys = [[MKStoreManager sharedManager] purchasableObjectsDescription ];
NSMutableArray * unremovableArray = [[NSMutableArray alloc] init];
for(int i = 0; i<[inAppKeys count]; i++){
for (int j=0; j< [categories count]; j++) {
NSString * inAppKey = [[categories objectAtIndex:j] valueForKey:@"inAppKey"];
if([inAppKey isEqualToString: [inAppKeys objectAtIndex:i]]){
[unremovableArray addObject:[categories objectAtIndex:j]];
}
}
}
categories = [[NSMutableArray alloc] init];
[categories addObjectsFromArray:unremovableArray];
,其中,一類是NSMutableArray的..關鍵是addObjectsFromArray離開類別爲空..我該怎麼辦錯了嗎?
你有沒有NSLog的上unremoveableArray?它首先有內容嗎? – Bourne
顯示您的NSLogs – zaph
穆罕默德,我的答案是否適合你? – mackworth