Created
August 25, 2012 23:08
-
-
Save Jmayhak/3472015 to your computer and use it in GitHub Desktop.
create pfobject relation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PFObject *myPost = [PFObject objectWithClassName:@"Post"]; | |
[myPost setObject:@"I'm Hungry" forKey:@"title"]; | |
[myPost setObject:@"Where should we go for lunch?" forKey:@"content"]; | |
// Create the comment | |
PFObject *myComment = [PFObject objectWithClassName:@"Comment"]; | |
[myComment setObject:@"Let's do Sushirrito." forKey:@"content"]; | |
// Add a relation between the Post and Comment | |
[myComment setObject:myPost forKey:@"parent"]; | |
// This will save both myPost and myComment | |
[myComment saveInBackground]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment