I trying fill array from existing filled array but sometimes get this error:
*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[4830]
Exception caused by this code line:
NSArray *result = [NSArray arrayWithArray:self.testerLog];
testerLog is NSMutableArray and I use it for collect logs from App. tester logs filled next way:
[self.testerLog addObject:[NSString stringWithFormat:@"%@: %@ \n", [NSDate date], logRecord]];
How it could happens? No exception when I add object to testerLog and fail when trying fill array from this filled array?
Edit: About initializing testerLog. Here is code of testerLog method:
- (NSMutableArray *)testerLog {
if (!_testerLog) {
_testerLog = [NSMutableArray array];
}
return _testerLog;
}
So I think it should be not nil.
UPDATE: I forget to say that method that add NSString to testerLog may called from several threads;