I got a question how i can count items in my plist file. I tried:
NSString *bundlePathofPlist = [[NSBundle mainBundle]pathForResource:@"Mything" ofType:@"plist"];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:bundlePathofPlist];
NSArray *dataFromPlist = [dict valueForKey:@"some"];
for(int i =0;i<[dataFromPlist count];i++)
{
//NSLog(@"%@",[dataFromPlist objectAtIndex:i]);
[self setTableData:[dataFromPlist count]];
}
NSLog(@"%@", tableData);
But on this line an error appears:
[self setTableData:[dataFromPlist count]];
Implicit conversion of 'NSUInteger' (aka 'unsigned int') to 'NSArray *' is disallowed with ARC
and warning:
Incompatible integer to pointer conversion sending 'NSUInteger' (aka 'unsigned int') to parameter of type 'NSArray *';
It looks like your
setTableDatatakes anNSArrayinstance. You need to prepare an array upfront in a loop, and then set it once, like this:This assumes that your
setTableDatamethod expects an array ofNSNumberinstances wrappingints.