Search code examples
iosquickblox

Quickblox - How to register New user in QuickBlox API


I'm new to iOS. I'm using custom authentication. I've checked sample code and i'm confused, how they are updating registered user in user panel while user is logged in.

Please tell How should i use their code, i downloaded and run their sample code but it is outdated and gives so many errors.

My authentication code while log in -

- (IBAction)signIn:(id)sender
{
  indicator.center = CGPointMake(160, 200);
  [self.view addSubview:indicator];
  [indicator startAnimating];
  NSString* urlString = [NSString stringWithFormat:@"http:***********************",userName.text,passWord.text];
  NSURL *add = [NSURL URLWithString:urlString];
  NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:add];
  (void) [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];

 [QBRequest createSessionWithSuccessBlock:^(QBResponse *response, QBASession *session)
 {
     // session created
     QBUUser *user = [QBUUser user];
     //user.password = @"azhhdsf";
     //user.login = @"dsfgsgf";

     user.login =  userName.text;
     user.password = passWord.text;


     // Registration/sign up of User
     [QBRequest signUp:user successBlock:^(QBResponse *response, QBUUser *user)
      {
          // Sign up was successful
      } errorBlock:^(QBResponse *response)
      {
          // Handle error here
          NSLog(@"error while signing up with QB");
      }];
  }
                              errorBlock:^(QBResponse *response)
  {
     // handle errors
     NSLog(@"%@", response.error);
 }

  ];
 }

Getting Thread Error-->

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[QBRequest createSessionWithSuccessBlock:errorBlock:]

I'm running their sample code for log in http://quickblox.com/developers/SimpleSample-users-ios#Adding_a_User_Base_to_your_application but getting error -

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MTBlockAlertView", referenced from:
   objc-class-ref in SSUEditViewController.o
   objc-class-ref in SSULoginViewController.o
   objc-class-ref in SSUMainViewController.o
   objc-class-ref in SSURegistrationViewController.o
 ld: symbol(s) not found for architecture i386
linker command failed with exit code 1 (use -v to see invocation)

As I'm new to iOS, so i could resolve this errors..


Solution

  • You must read first a guide how to start using QuickBlox

    http://quickblox.com/developers/IOS#Oh.2C_please.2C_please_show_me_the_code

    As I understand you didn't setup the QuickBlox application properly, that's why you get this exception

    Then download Users sample http://quickblox.com/developers/SimpleSample-users-ios , play with it and read Users sample guide