I am developing a mobile app in iOS native for Salesforce users using the Salesforce mobile SDK. Almost I have completed the basic features like create, edit and delete records from my mobile app. I provided the logout option too. But the problem is when I logout the account in mobile app, it's logged out well. Then again, I am trying to login with same account, it allows the user to enter without Salesforce verification code. It seems something went wrong or something not cleared while logout. I don't have clear idea about this. I need the app asking each time verification code while login. I don't know anything I missed while logout. Please help me to resolve this issue.

Here is the code which I used to logout the account:

SFUserAccountManager *SFA=[SFUserAccountManager sharedInstance];
[SFA clearAllAccountState];
[SFA switchToNewUser];
[[SFAuthenticationManager sharedManager] logout];
[[NSNotificationCenter defaultCenter] postNotificationName:kSFUserWillLogoutNotification object:[SFAuthenticationManager sharedManager]];

You need only single statement

[[SFAuthenticationManager sharedManager] logout];

Don't do these.

SFA clearAllAccountState]; [SFA switchToNewUser];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.