Created
November 4, 2015 18:08
-
-
Save llSourcell/66b608fd986e5ec9f19a to your computer and use it in GitHub Desktop.
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
- (void)login { | |
PFUser *user = [PFUser user]; | |
//this is hardcoded but you can get also get it from an input textfield | |
user.username = @"my name"; | |
user.password = @"my pass"; | |
user.email = @"email@example.com"; | |
// other fields can be set just like with PFObject | |
user[@"phone"] = @"415-392-0202"; | |
[user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { | |
if (!error) { // Hooray! Let them use the app now. | |
//once we have successfully authenticated via Parse, we can safely connect to the given channel name | |
//with the same username | |
[self.channel.members inviteByIdentity:user.username | |
completion:^(TMResultEnum result) { | |
if (result == TMResultSuccess) { | |
NSLog(@"User invited!"); | |
} else { | |
NSLog(@"User could not be invited."); | |
} | |
}]; | |
} else { NSString *errorString = [error userInfo][@"error"]; // Show the errorString somewhere and let the user try again. | |
} | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment