且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将字符串对象添加到NSMutableArray

更新时间:2022-11-15 21:46:21

我认为您缺少为数组分配内存的方法.所以试试这个

I think you are missing to allocate the memory for array. So try this

NSMutableArray *randomSelection = [[NSMutableArray alloc] init];
[randomSelection addObject:@"string1"];
NSString *test = [randomSelection objectAtIndex:0];
NSLog(test);