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 trial

iOS Build a Self-Destructing Message iPhone App Relating Users in Parse.com Removing Friends by Tapping on a Table View Cell

Todd Hoff
PLUS
Todd Hoff
Courses Plus Student 159 Points

Is the friends table view being updated? When you go back to friends from edit friends the checkmarks are still there.

Do we need to refresh the table or otherwise know when the model has changed on a redisplay?

2 Answers

Stone Preston
Stone Preston
42,016 Points

I think this problem is addressed in the next video or two. you might try watching the next ones and see if it gets fixed (I think it does)

Michael Liquori
Michael Liquori
8,131 Points

Stone Preston Todd Hoff This problem is not addressed anymore by the other forum posts nor future videos. I don't know if the new XCode broke it or what, but I have spent all day trying to get this to work and finally figured it out through Stack Overflow and debugging with NSLogs.

The problem has been that the prepareForSegue causes an error, claiming that friends is not a property of EditFriendsViewController. Everytime I did something to "fix" it it turned out that I was only ignoring the prepareForSegue and hence NSMutableArray friends would be null and nothing would really work.

Here is the solution (put this and only this inside of the if statement which is nested inside prepareForSegue):

UINavigationController *navController = (UINavigationController *)segue.destinationViewController;
EditFriendsViewController *controller = (EditFriendsViewController *)navController.topViewController;
controller.friends = [NSMutableArray arrayWithArray:self.friends];

Thanks entirely to this stackoverflow post.