2
我定義了下面的列表swift類,並嘗試從viewcontroller調用sfAuthenticateUser。但Xcode智能感知列出了除我定義的類型之外的錯誤參數類型。Swift函數調用列表不正確的參數類型
錯誤:無法將類型的值 '串' 預期參數類型 'APISFAuthentication'
的Xcode 7.1版本(7B91b)
// - 視圖 - 控制器方法調用如下
@IBAction func ActionNext(sender: AnyObject) {
let sss = APISFAuthentication.sfAuthenticateUser(<#T##APISFAuthentication#>)
}
//類定義如下
class APISFAuthentication {
init(x: Float, y: Float) {
}
func sfAuthenticateUser(userEmail: String) -> Bool {
let manager = AFHTTPRequestOperationManager()
let postData = ["grant_type":"password","client_id":APISessionInfo.SF_CLIENT_ID,"client_secret":APISessionInfo.SF_CLIENT_SECRET,"username":APISessionInfo.SF_GUEST_USER,"password":APISessionInfo.SF_GUEST_USER_PASSWORD]
manager.POST(APISessionInfo.SF_APP_URL,
parameters: postData,
success: { (operation, responseObject) in
print("JSON: " + responseObject.description)
},
failure: { (operation, error) in
print("Error: " + error.localizedDescription)
})
return true;
}
}