I have an iPad app with Salesforcemobilesdk-ios integrated. First time, as soon as I login I set all the credentials in oauthCoordinatorDidAuthenticate method like this -

- (void) oauthCoordinatorDidAuthenticate: (SFOAuthCoordinator *) coordinator authInfo:(SFOAuthInfo *)info 

    [SFAuthenticationManager sharedManager].coordinator = coordinator;
    [[SFAuthenticationManager sharedManager] coordinator].credentials = coordinator.credentials;
    SFUserAccount *userAccount = [[SFUserAccount alloc]initWithIdentifier:s_currentAccountIdentifier];
    userAccount.credentials = coordinator.credentials;
    userAccount.accessScopes = coordinator.scopes;
    [SFUserAccountManager sharedInstance].currentUser = userAccount;
    [[SFUserAccountManager sharedInstance] applyCredentials:coordinator.credentials];
    [[SFUserAccountManager sharedInstance] saveAccounts:nil];

It works fine when I try and check valid OAuth session when I am using or in background.

But when I close the app(app terminated) and launch it again, SFUserAccountManager couldn't retrieve the details and check for valid session, instead showing salesforce login screen again.

How to make sure that SFUserAccountManager and SFAuthenticationManager saves its details even when I close the app and launch it again.




You must log in to answer this question.

Browse other questions tagged .