int main(int argc,const char * argv []){ @autoreleasepool {
NSMutableArray *myMute;
NSString *stringOne = @"This is string 1";
NSString *stringTwo = @"This is string 2";
NSString *stringThree = @"This is string 3";
[myMute addObject: stringOne];
[myMute addObject: stringTwo];
[myMute addObject: stringThree];
NSLog(@"There are %li objects in the myMute array", [myMute count]);
return 0;
}
}
答案 0 :(得分:-1)
只需分配你创建nil数组的数组,你必须用new或alloc
分配内存NSMutableArray *myMute = [NSMutableArray new];
NSString *stringOne = @"This is string 1";
NSString *stringTwo = @"This is string 2";
NSString *stringThree = @"This is string 3";
[myMute addObject: stringOne];
[myMute addObject: stringTwo];
[myMute addObject: stringThree];
NSLog(@"There are %li objects in the myMute array", [myMute count]);
return 0;