Reputation: 7846
I have this line of code being called when the user taps a row on a table. It works at random and then it stops working all together giving a EXC_BAD_ACCESS. I have NSZombieEnabled on, but it doesn't show anything.
[api make_call:@"update_privacy" api_objects:[NSArray arrayWithObjects:@"username", [[NSUserDefaults standardUserDefaults] objectForKey:@"username"], @"privacy_setting", indexPath.row, nil]];
Thanks for any help in advance!
Upvotes: 1
Views: 419
Reputation: 6139
indexPath.row
isn't an NSObject
, you can't add if to the array.
Check that [[NSUserDefaults standardUserDefaults] objectForKey:@"username"] isn't returning nil.
Upvotes: 4
Reputation: 8735
You should print your variables, which you aren't sure about value, in order to see what happend.
id username = [[NSUserDefaults standardUserDefaults] objectForKey:@"username"];
NSArray *array = [NSArray arrayWithObjects:
@"username",
username,
@"privacy_setting",
indexPath.row,
nil];
NSlog(@"%@ - %d - %@", username, indexPath.row, array);
[api make_call:@"update_privacy" api_objects:array];
Upvotes: 1