Return to Snippet

Revision: 70152
at December 3, 2015 05:06 by TenDegrees


Updated Code
-(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
{
    Profile *newUser = [[Profile alloc]init];
    newUser.name=name;
    newUser.icon=profileImageData;
    newUser.email=email;
    newUser.scope=ScopePublic;
    newUser.emailScope = ScopePublic;
    
    [self createUnityProfile:newUser withPassword:password withCompletionBlock:^(Profile * object, bool success, NSString * errorMessage)
    {
        completionBlock(object,success,errorMessage);
    }];

}


-(IBAction)createAccountButtonWasPressed:(id)sender
{

    NSString *imageData = [self convertUIImageToNSString]; // convert a UIImage to NSString

    [self createAccountWithName:self.firstNameTextField.text withEmail:self.emailTextField.text withPassword:self.passwordTextField.text withScope:ScopePublic withProfileImage:imageData withCompletionBlock:^(Profile * object, bool success, NSString * errorMessage){
        
        if(success)
        {
           if(object)
           {
               // store user profile
           }
            else
            {
                NSLog(@"No object returned");
            }
        }
        else
        {
            NSLog(@"%@",errorMessage);
        }
    }];

}

Revision: 70151
at December 3, 2015 04:51 by TenDegrees


Initial Code
-(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
{
    Profile *newUser = [[Profile alloc]init];
    newUser.name=name;
    newUser.icon=profileImageData;
    newUser.email=email;
    newUser.scope=ScopePublic;
    newUser.emailScope = ScopePublic;
    
    [self createUnityProfile:newUser withPassword:password withCompletionBlock:^(Profile * object, bool success, NSString * errorMessage)
    {
        completionBlock(object,success,errorMessage);
    }];

}

Initial URL


Initial Description
A method to create a Unity account

Initial Title
Unity Account Creation

Initial Tags


Initial Language
Objective C