Registers the user to the SAP Mobile Platform on-premise or cloud.
-(BOOL)registerUser:(NSString*)userName password:(NSString*)loginPassword error:(NSError**)error isSyncFlag:(BOOL)isSynchronous;
{
SMPClientConnection* clientConn = [SMPClientConnection initializeWithAppID:@"<application_id>" domain:@"default"
secConfiguration:@"<Security_configuration>"];
[clientConn setConnectionProfileWithUrl:@"http://<server_host>:<server_http_port>"];
NSError* error = nil;
[SMPUserManager setDelegate:self];
[SMPUserManager setCaptchaChallengeDelegate:self];
SMPUserManager* userManager = [SMPUserManager initializeWithConnection:clientConn];
[userManager registerUser:@"GW_Username" password:@"GW_password" error:&error isSyncFlag:NO];
//…
//…
}
-(void)userRegistrationSuccessful
{
}
-(void)userRegistrationFailed:(NSError*)error
{
// Error handling using the error object
NSLog(“%@”,error);
}
-(NSString*)didReceiveCaptchaChallenge:(NSString*)base64ImageString
{
NSError* error = nil;
[userManager registerUser:@"GW_Username" password:@"GW_password" captchaText:@"captchText" error:&error isSyncFlag:NO])
return nil;
}
{
SMPClientConnection* clientConn = [SMPClientConnection initializeWithAppID:@"<application_id" domain:@"default"
secConfiguration:@"<Security_configuration>"];
[clientConn setConnectionProfileWithHost:@"<server_host/relayserver_host>"port:@"<http_port/relayserver_port>"
farm:<nil/relaysrever_farmid> relayServerUrlTemplate:<nil/relayserverURLtemplate> enableHTTP:YES];
NSError* error = nil;
[SMPUserManager setDelegate:self];
[SMPUserManager setCaptchaChallengeDelegate:self];
SMPUserManager* userManager = [SMPUserManager initializeWithConnection:clientConn];
[userManager registerUser:@"GWUsername" password:@"GWPassword" error:&error isSyncFlag:NO];
//…
//…
}
-(void)userRegistrationSuccessful
{
}
-(void)userRegistrationFailed:(NSError*)error
{
// Error handling using the error object
NSLog(“%@”,error);
}
//For added security, use CAPTCHA when registering in a Cloud environment
-(NSString*)didReceiveCaptchaChallenge:(NSString*)base64ImageString
{
NSError* error = nil;
[userManager registerUser:@"GW_Username" password:@"GW_password" captchaText:@"captchText" error:&error isSyncFlag:NO])
return nil;
}