iActiveRecord
iActiveRecord copied to clipboard
Attempt to mutate immutable object with appendFormat:
Using the following lines:
ARLazyFetcher* fetcher = team.users;
User* asker = [self asker];
if (asker != nil) {
[fetcher where:@"'user'.'serverUserId' != %@", asker.serverUserId, nil];
return fetcher.fetchRecords;
}
crashed from
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Attempt to mutate immutable object with appendFormat:'
on
[fetcher where:@"'user'.'serverUserId' != %@", asker.serverUserId, nil];
Could you add breakpoint to [fetcher where:...
and print description of fetcher.whereStatement
?
Seems that whereStatement
is not a mutable string.
Printed the description:
Printing description of fetcher:
<ARLazyFetcher: 0x1287cc20>
Printing description of fetcher->whereStatement:
"Member"."teamId" = "1"
@AlexDenisov it happens sometimes to me too, mutable objects become immutable. I guess you could secure this by using myObject = [myObject mutableCopy]
where you feel like it could go wrong.