Reputation: 490
I'm new to Xcode. what i want is read plist data locally in my program. i got
NSArrayM insertObject:atIndex:]: object cannot be nil
error. Here is what i declared and my plist file. Thanks
NSMutableArray *phoneArray;
NSString *path=[[NSBundle mainBundle] pathForResource:@"PhoneList" ofType:@"plist"];
phoneArray= [[NSMutableArray alloc]initWithContentsOfFile:path];
key type Item 0 Dictionary Item 1 Dictionary
Items have description, name keys as type of String.
Upvotes: 1
Views: 3788
Reputation: 1691
- (void)insertObject:(id)anObject atIndex:(NSUInteger)index
The object to add to the array's content. This value must not be nil.
before any input from the plist file, please check to see that the element is not nil, to avoid the excetion
Upvotes: 0
Reputation: 112857
Verify your plist, there is most likely a bad value. Items in an NSArray
or NSDictionary
can not be null. You can use Xcode to open the plist file to verify it.
Personally I use "PlistEdit Pro", it can provide somewhat better diagnostics when the plist is invalid. There is a Free Trial here of PlistEdit Pro.
Upvotes: 2