function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JosephNardoneJosephNardone 

How do I query for username after oAuth in iOS SDK?

Hi:

I want to display the username in my iOS app so that the user know which account they logged in as (if they have more than one).  I am using the latest SDK and oAuth2.0 flow where the user logs in through the salesfoce UIWebview.  How can I get the username?

Thanks,

Joseph

 

Best Answer chosen by Admin (Salesforce Developers) 
JosephNardoneJosephNardone

Figured it out:

 

 

#import "SFIdentityData.h"

 

NSString *userName = [SFAccountManager    sharedInstance].idData.username;

All Answers

JosephNardoneJosephNardone

Figured it out:

 

 

#import "SFIdentityData.h"

 

NSString *userName = [SFAccountManager    sharedInstance].idData.username;

This was selected as the best answer
cdolcdol

Its giving me a problem with SFAccountManager ? 

 

I know its the recently-made-public resource with the latest version of the SDK, but I'm getting the error 

 

"... use of an undeclared identifier 'SFAccountManager' "

 

Any words of wisom?