Register a user using a predefined authentication mechanism asynchronously.
SMPClientConnection *clientConn=[ SMPClientConnection initializeWithAppID : @”com.sap.NewFlight” domain : @”default” secConfiguration : @”HttpAuth” ];
[clientConn setConnectionProfileWithHost:@”10.66.187.60” port:@”8000” farm:nil relayServerUrlTemplate:nil enableHTTP:YES];
Set the delegate in case of asynchronous registration. This class has to implement SMPUserManagerDelegate to get the callback
[SMPUserManager setDelegate:self];
Initialize the UserManager with clientConnection as one of the parameter and using SMPUserManager* userManager = [SMPUserManager initializeWithConnection:clientConn];
SMPUserManager *userManager = [SMPUserManager initializeWithConnection:clientConn];
[userManager registerUser:@”supuser” password:@”s3puser” error :nil isSyncFlag:NO ];
Implement these two callbacks for successful registration or registration failure.
-(void)userRegistrationSuccessful:(SMPUserManager *)userManager { //Registration Successful /* Get the Application connection ID send by server after successful registration using [userManager applicationConnectionID] which can be set using [clientConn setApplicationConnectionID:ApplicationConnectionId]; whenever application restarts. */ NSString *appConnID=[userManager applicationConnectionID]; } -(void)userRegistrationFailed:( SMPUserManager *)userManager { NSError *error=[userManager registrationError]; NSLog(@"User Registration Failed with error: %@",[error description]); }