原生快速开发的新手!在https://github.com/forcedotcom/SalesforceMobileSDK-iOS/issues/2072中打开了以下问题
使用的移动 SDK 版本:5.1.0
在 Native App 或 Hybrid App 中发现问题:Native App
OS 版本:10.12.5
设备:iPhone 6
重现步骤:
- 强制创建
- 提供应用程序类型
native_swift
并添加其他请求的详细信息 *.xcworkspace
在 Xcode 中打开文件- 构建项目
错误:Value id optional type '[SFUserAccount]?' not unwrapped;
func handleSdkManagerLogout()
{
self.log(.debug, msg: "SFAuthenticationManager logged out. Resetting app.")
self.resetViewState { () -> () in
self.initializeAppViewState()
// Multi-user pattern:
// - If there are two or more existing accounts after logout, let the user choose the account
// to switch to.
// - If there is one existing account, automatically switch to that account.
// - If there are no further authenticated accounts, present the login screen.
//
// Alternatively, you could just go straight to re-initializing your app state, if you know
// your app does not support multiple accounts. The logic below will work either way.
var numberOfAccounts : Int;
let allAccounts = SFUserAccountManager.sharedInstance().allUserAccounts()
numberOfAccounts = (allAccounts!.count);
if numberOfAccounts > 1 {
let userSwitchVc = SFDefaultUserManagementViewController(completionBlock: {
action in
self.window!.rootViewController!.dismiss(animated:true, completion: nil)
})
if let actualRootViewController = self.window!.rootViewController {
actualRootViewController.present(userSwitchVc!, animated: true, completion: nil)
}
} else {
if (numberOfAccounts == 1) {
SFUserAccountManager.sharedInstance().currentUser = allAccounts[0]
// ERROR: Value id optional type '[SFUserAccount]?' not unwrapped;
}
SalesforceSDKManager.shared().launch()
}
}
}