Unity Account Creation


/ Published in: Objective C
Save to your folder(s)

A method to create a Unity account


Copy this code and paste it in your HTML
  1. -(void)createAccountWithName:(NSString *)name withEmail:(NSString *)email withPassword:(NSString *)password withScope:(Scope)scope withProfileImage:(NSString *)profileImageData withCompletionBlock:(void(^)(Profile * object, bool success, NSString * errorMessage)) completionBlock
  2. {
  3. Profile *newUser = [[Profile alloc]init];
  4. newUser.name=name;
  5. newUser.icon=profileImageData;
  6. newUser.email=email;
  7. newUser.scope=ScopePublic;
  8. newUser.emailScope = ScopePublic;
  9.  
  10. [self createUnityProfile:newUser withPassword:password withCompletionBlock:^(Profile * object, bool success, NSString * errorMessage)
  11. {
  12. completionBlock(object,success,errorMessage);
  13. }];
  14.  
  15. }
  16.  
  17.  
  18. -(IBAction)createAccountButtonWasPressed:(id)sender
  19. {
  20.  
  21. NSString *imageData = [self convertUIImageToNSString]; // convert a UIImage to NSString
  22.  
  23. [self createAccountWithName:self.firstNameTextField.text withEmail:self.emailTextField.text withPassword:self.passwordTextField.text withScope:ScopePublic withProfileImage:imageData withCompletionBlock:^(Profile * object, bool success, NSString * errorMessage){
  24.  
  25. if(success)
  26. {
  27. if(object)
  28. {
  29. // store user profile
  30. }
  31. else
  32. {
  33. NSLog(@"No object returned");
  34. }
  35. }
  36. else
  37. {
  38. NSLog(@"%@",errorMessage);
  39. }
  40. }];
  41.  
  42. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.