Last active
November 4, 2015 18:13
-
-
Save llSourcell/4816a85a1bd2db280d43 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)myMethod { | |
PFUser *user = [PFUser user]; | |
user.username = @"my name"; | |
user.password = @"my pass"; | |
user.email = @"[email protected]"; | |
// other fields can be set just like with PFObject | |
user[@"phone"] = @"415-392-0202"; | |
[user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { | |
if (!error) { | |
// Now that they've authenticated with Parse, we can 'login' via IPM | |
[[IPMessagingManager sharedManager] loginWithIdentity:user.username]; | |
} else { NSString *errorString = [error userInfo][@"error"]; // Show the errorString somewhere and let the user try again. | |
} | |
}]; | |
} | |
- (BOOL)loginWithIdentity:(NSString *)identity { | |
if (self.client) { | |
[self logout]; | |
} | |
[self storeIdentity:identity]; | |
NSString *token = [self tokenForIdentity:identity]; | |
self.client = [TwilioIPMessagingClient ipMessagingClientWithToken:token | |
delegate:nil]; | |
return YES; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment