Query for username in Salesforce iOS SDK

前端 未结 5 1354
生来不讨喜
生来不讨喜 2021-01-22 16:27

I have an iOS app using the latest Salesforce iOS SDK. It authenticates users through a webview using oAuth2.0 on the Salesforce site so I do not capture the username in my app

5条回答
  •  忘掉有多难
    2021-01-22 16:49

    You need to import SFAuthenticationManager.h class

    #import 
    

    then you can get user details (first name, last name, email etc.) this way

    NSLog(@"userData= %@",[SFAuthenticationManager sharedManager].idCoordinator.idData);
    
    NSLog(@"first name = %@",[SFAuthenticationManager sharedManager].idCoordinator.idData.firstName);
    NSLog(@"last name = %@",[SFAuthenticationManager sharedManager].idCoordinator.idData.lastName);
    NSLog(@"email name = %@",[SFAuthenticationManager sharedManager].idCoordinator.idData.email);
    

提交回复
热议问题