You need to sign in to do that
Don't have an account?
Manish Kumar 61
Mobile SDK - iOS Native App - How to Switch user while logging out
Can anyone tell me if it's possible to programmatically switch to another user while logging out of a native iOS app built using Mobile SDK?
I'm currently doing a logout by doing
and then re-directing back to login screen. I read somewhere that it's possible to do it directly as Mobile SDK supports multiple parallel logins but not sure how to do it.
I'm currently doing a logout by doing
[SFUserAccountManager sharedInstance].currentUser = ([SFUserAccountManager sharedInstance].allUserAccounts)[0];
and then re-directing back to login screen. I read somewhere that it's possible to do it directly as Mobile SDK supports multiple parallel logins but not sure how to do it.
This will allow you to switch users without explicitly logging them out and logging them in again. The key here is to first check if you have more than one user logged into app.
If there is only one user, you can simply logout. If there are multiple users, you don't logout, instead you use
SFDefaultUserManagementViewController
to switch to the other user.
I hope this helps.
If my answer helps resolve your query, please mark it as the 'Best Answer' to benefit others and improve the overall quality of Discussion Forums.
Gaurav Kheterpal
Certified Force.com Developer| Developer Forums Moderator| Dreamforce Speaker