Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialrobert cioffi
3,466 Pointslibc++abi.dylib: terminating with uncaught exception of type NSException
I think with the newer version of iOS or Xcode there is a bug, because I've typed everything as in the video but sometimes I get this exception, I did some debugging and found that the line that causes it is:
[message setObject:self.recipients forKey:@"recipientIds"];
Otherwise without that key identifier it works fine. anybody having the same issue? anyone know how to fix it?
thanks
3 Answers
Stone Preston
42,016 Pointscan you post more information about the exception. it should provide some more information about it in the console
robert cioffi
3,466 PointsAnybody have the same problem or have a solution for my question above?
reardelt
8,030 PointsHI Robert, I think I had the same issue. The self.recipient was null. I think the issue is when we set self.recipient =nil in the reset method. the reset method is called before we send the data off to parse.com
reardelt
8,030 Pointsso I guess don't remove all Objects from in reset method. remove all objects in the viewWillAppear method.
Stone Preston
42,016 Pointslooks like you implemented the incorrect tableViewDelegate method. you implemented didDeselectRowAtIndexPath:
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.tableView deselectRowAtIndexPath:indexPath animated:NO];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
PFUser *user = [self.friends objectAtIndex:indexPath.row];
if(cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
[self.recipients addObject:user.objectId];
}
else {
cell.accessoryType = UITableViewCellAccessoryNone;
[self.recipients removeObject:user.objectId];
}
}
but you should have implemented didSelectRowAtIndexPath. change the method name to didSelect:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.tableView deselectRowAtIndexPath:indexPath animated:NO];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
PFUser *user = [self.friends objectAtIndex:indexPath.row];
if(cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
[self.recipients addObject:user.objectId];
}
else {
cell.accessoryType = UITableViewCellAccessoryNone;
[self.recipients removeObject:user.objectId];
}
}
see if that fixes things
robert cioffi
3,466 Pointsrobert cioffi
3,466 PointsOk, the specific error is: 2014-08-22 13:12:28.185 ribbit[1050:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't use nil for keys or values on PFObject. Use NSNull for values.' *** First throw call stack: (0x2e7e0f03 0x38f75ce7 0x2e7e0e45 0x10f21d 0x10f3eb 0x10046b 0x14f1d7 0x14efc1 0x3945ed53 0x3945ed3f 0x394616c3 0x2e7ab679 0x2e7a9f45 0x2e7147a9 0x2e71458b 0x336816d3 0x31073891 0x10186d 0x39473ab7) libc++abi.dylib: terminating with uncaught exception of type NSException
the real question is why is it a nil key?
and I did what Ben J said to do on someone else's post about a similar issue which is do the NSLog: NSLog(@"%@", self.friends); and it outputs: 2014-08-22 13:11:18.297 ribbit[1050:60b] ( "<PFUser:SN4AVKxV1J:(null)> {\n email = \"dfd@dfd.com\";\n friendsRelation = \"<PFRelation: 0x16592db0>(<00000000>.(null) -> _User)\";\n username = bob;\n}"
SO it appears there is a null in that output, I'm not sure what to fix because if I take message[@"recipientsIds"] = self.recipients; out of the CameraViewController, the image uploads to Parse.com just fine, but then it doesn't have associated recipients listed. This means self.recipients isn't being loaded somewhere else in the file, but where?
}
****This is why I originally gave up on this project a month ago, I want to figure this out and move on