Migrate iOS Online Data Proxy applications from 2.1 ESD #3 (or earlier) to 2.2.
These steps use an example scenario that includes before and after code snippets, removed code snippets, and additional information.
@try { if ([LiteSUPAppSettings isSUPKeyProvisioned]) { [LiteSUPUserManager clearServerVerificationKey]; } LiteSUPUserManager* userManager = [LiteSUPUserManager getInstance:@"NewFlight"]; [ODPClientListeners setCertificateChallengeListenerDelegate:self]; [ODPClientListeners setHTTPAuthChallengeListenerDelegate:self]; [ODPClientListeners setHTTPErrorListenerDelegate:self]; [userManager setDelegate:self]; [userManager setDidFailToRegisterUser:@selector(registrationSuccessful:)]; [userManager setDidSuccessfulUserRegistration:@selector(registrationFailed:)]; [userManager setConnectionProfile:@"10.53.138.119" withSupPort:5001 withServerFarmID:@"0"]; [userManager registerUser:@"supuser" withSecurityConfig:@"HttpAuth" withPassword:@"s3puser"]; } @catch (NSException *exception) { NSLog(@"%@", [exception reason]); }
if ([ODPAppSettings isServerKeyProvisioned]) { [ODPClientConnection clearServerVerificationKey]; } ODPUserManager* userManager = [ODPUserManager getInstance:@"com.sap.NewFlight"]; [ODPClientListeners setCertificateChallengeListenerDelegate:self]; [ODPClientListeners setHTTPAuthChallengeListenerDelegate:self]; [ODPClientListeners setHTTPErrorListenerDelegate:self]; [userManager setDelegate:self]; [userManager setConnectionProfileWithHost:@"10.53.138.119" port:5001 farm:@"0" error:nil]; NSError* regError = nil; [userManager registerUser:@"supuser" securityConfig:@"SSO" password:@"s3puser" error:®Error isSyncFlag:NO]; if (regError) { NSLog(@"%@", regError); }
[userManager registerUser:@"user" withSecurityConfig:@"sec" withPassword:@"pwd" withVaultPassword:@"vaultpwd"]; [userManager registerUserAsynchronousWithUserName:@"user" activationCode:@"code"]; [userManager registerUserAsynchronousWithUserName:@"user" securityConfig:@"sec" password:@"pwd"]; [userManager registerUserAsynchronousWithUserName:@"user" securityConfig:@"sec" password:@"pwd" vaultPassword:@"vaultpwd"]; [userManager setConnectionProfileFromAfaria:url appUrlScheme:urlScheme]; NSMutableDictionary* settings = [userManager getSettingsFromAfariaWithUrl:url UrlScheme:urlScheme];
id<SDMRequesting> request = [SDMRequestBuilder requestWithURL:[NSURL URLWithString: [LiteSUPAppSettings getApplicationEndPoint]]; [request setUsername:@"user"]; [request setPassword:@"pwd"]; [request setDelegate:self]; [request setRequestMethod:@"GET"]; [request addRequestHeader:@"X-CSRF-Token" value:@"Fetch"]; [request setDidFailSelector:@selector(requestFailed:)]; [request setDidFinishSelector:@selector(requestFinished:)]; [request startAsynchronous]; NSString* xCsrfToken = [[request responseHeaders] objectForKey:@"X-CSRF-TOKEN"];
[SDMRequestBuilder enableXCSRF:YES]; id<SDMRequesting> request = [SDMRequestBuilder requestWithURL:[NSURL URLWithString: [ODPAppSettings getApplicationEndpointWithError:nil]]]; [request setUsername:@"user"]; [request setPassword:@"pwd"]; [request setDelegate:self]; [request setRequestMethod:@"GET"]; [request setDidFailSelector:@selector(requestFailed:)]; [request setDidFinishSelector:@selector(requestFinished:)]; [request startAsynchronous];
Removed: nothing has been removed from the SDMRequesting interface.
The difference here is the restructuring of classes. The message to stop the client has been renamed and grouped under a different class, and exception handling has been replaced with error handling using the standard error object.
@try { LiteSUPUserManager* userManager = [LiteSUPUserManager getInstance:@"NewFlight"]; [userManager shutDown]; [userManager deleteUser]; } @catch (NSException *exception) { NSLog(@"%@", [exception reason]); }
ODPUserManager* userManager = [ODPUserManager getInstance:@"com.sap.NewFlight"]; ODPClientConnection* clientConnection = [ODPClientConnection getInstance:@"com.sap.NewFlight"]; [clientConnection stopClient]; NSError* error = nil; [userManager deleteUserWithError:&error];
Removed: nothing has been removed from the interface.
This section discusses the client-side API, which gets the device token and passes it to Unwired Server. The only major change is renaming the class that holds these methods.
[LiteSUPMessagingClient setupForPush:app]; [LiteSUPMessagingClient deviceTokenForPush:app deviceToken:token]; [LiteSUPMessagingClient pushNotification:app notifyData:dataDict]; [LiteSUPMessagingClient pushRegistrationFailed:app errorInfo:error];
[SUPUtilities setDelegate:self];The delegates for these methods have remained the same; the information has not been repeated here.
[ODPClientConnection setupForPush:app]; [ODPClientConnection deviceTokenForPush:app deviceToken:token]; [ODPClientConnection pushNotification:app notifyData:dataDict]; [ODPClientConnection pushRegistrationFailed:app errorInfo:error];
[ODPClientConnection registerForPayloadPush:self];
Removed: nothing has been removed from the interface.
LiteSUPCertificateStore* store = [LiteSUPCertificateStore getInstance]; NSString* base64string = [store getSignedCertificateFromFile:filePath withCertificatePassword:password];
NSString* base64string = [ODPCertificateManager getSignedCertificateFromFile:filePath withCertificatePassword:password];
LiteSUPCertificateStore* store = [LiteSUPCertificateStore getInstance]; [store getSignedCertificate:cert withCertificatePassword:password]; [store getSignedCertificateFromAfariaForURL:url withUsername:username withPassword:password]; [store getSignedCertificateFromAfariaForURLScheme:urlScheme withUsername:username withPassword:password]; [store getSignedCertificateFromServer:server withPassword:password withCertificatePassword:passCert];
Since Afaria is a standalone, separately consumable library in version 2.2, no methods related to Afaria are exposed as a part of the Online Data Proxy interface. Application developers must consume the Afaria library directly.