I\'m getting an EXC_BAD_ACCESS (or a malloc error) on the following line of code:
NSLog(@\"Points:\");
Which makes zero sense to me, as it
Old question but in Swift you'll get this issue if you are logging an encoded URL which contains '%' - For example:
NSLog("My long Encoded URL: \(myLongUrlVar)")
Instead, it will work with params:
NSLog("My long Encoded URL: %@", myLongUrlVar)
First thing I would try (after zombie hunting or perhaps before in this case) is to clear out the build directories and do a fresh rebuild. Sometimes left over cruft from prior builds can cause strange problems.
there are % in string, replace % to %%
NSLog([message stringByReplacingOccurrencesOfString:@"%" withString:@"%%"]);
In the comments I suggested:
The problem is not with
NSLog. The problem is probably that some memory is getting smashed and that is causing the crash inNSLog. It would probably help if you could break down that method you're using to make it easier to read, perhaps even separating the functionality into a new object. Also, avoid the use of magic numbers (3 & 6).
It appears that @haldean went with this suggestion and tracked down the problem. I can't claim credit for actually doing the hard work of tracking down the problem, but I'm happy the suggestion helped.