I am new to iPhone SDK.I am printing each and every array in console.No matter how much data consume.and I note that some times my application is crashing.it gives me BAD_ACCESS and pointer showing on my NSLog line.I am confused can NSLog crash the application?
Here is my code :
for (int i = 0; i < [UserNeedListArray count]; i++) {
EndUserNeed* aEndUser = [UserNeedListArray objectAtIndex:i];
if ([appData.CurrentUser.userId isEqualToString:aEndUser.UserId]) {
NSMutableArray* temp = [[NSMutableArray alloc]init];
[temp addObject:aEndUser];
NSLog(@"%@",temp);
[arr_ShowMyOnly addObject:[temp objectAtIndex:0]];
NSLog(@"%@",arr_ShowMyOnly);
[temp removeAllObjects];
[temp release];
temp = nil;
}
}
Please help me.Thanking you…
Yes it can. when you do
NSLog(@"%@",temp);it expects thattempis a type of NSString class.In your case you should do
NSLog(@"%@",[temp description]);Almost all the classes have a description method that will return you an NSString object.