空NSMutableArray,不知道为什么 [英] Empty NSMutableArray , not sure why
本文介绍了空NSMutableArray,不知道为什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好的,所以我填充这样的数组:
Ok so I populate the array like this:
NSMutableArray *participants;
for(int i = 0; i < sizeofpm; i++){
NSDictionary *pmpart_dict = [pm_participants objectAtIndex:i];
NSString *pmpart_email = [pmpart_dict objectForKey:@"email"];
NSString *pmpart_email_extra = [@"pm" stringByAppendingString:pmpart_email];
[participants setValue:pmpart_email forKey:pmpart_email_extra];
NSLog(@"%@", participants);
}
sizeofpm是1.正在使用count。获取数组中的值的数量。如何将值存储到该数组?它似乎没有工作。谢谢!
sizeofpm is 1. that is using count. to get the number of values in the array. How can i store values to that array? It doesnt seem to be working. Thanks!
推荐答案
您需要先分配它。尝试将第一行更改为:
you need to alloc it first. Try to change the first line to:
NSMutableArray * participant = [[NSMutableArray alloc] init];
还使用 setValue:forKey:
不能使用 NSMutableArray
因为数组没有键。
also using setValue:forKey:
wont work with an NSMutableArray
as an array has no key.
尝试使用 [参与者addObject:pmpart_email];
。
这篇关于空NSMutableArray,不知道为什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文