Query for username in Salesforce iOS SDK

前端 未结 5 1238
生来不讨喜
生来不讨喜 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:42

    SalesforceMobileSDK-iOS 7.0

    Swift Version

    import SalesforceSDKCore
    
    guard let userId = UserAccountManager.shared.currentUserAccountIdentity?.userId else {return}
    

    Depends on what you need, this maybe helpful as well:

    guard let userId = UserAccountManager.shared.currentUserAccount?.idData?.userId else {return}
    

提交回复
热议问题