【发布时间】:2016-01-20 17:13:41
【问题描述】:
我收到以下错误。我的 XCode 7.1 版,
/Users/chamath/Desktop/SwiftNvoi/Mobile/Mobile/APISFAuthentication.swift:30:22:无法将类型“(AFHTTPRequestOperation!,NSError!)->()”的值转换为预期的参数类型“((AFHTTPRequestOperation ?, NSError) -> Void)?'
import Foundation
class APISFAuthentication {
init(x: Float, y: Float) {
}
func fAuthenticateUser(userEmail: String) -> String {
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: AFHTTPRequestOperation!,responseObject: AnyObject!) in
print("JSON: " + responseObject.description)
},
failure: { (operation: AFHTTPRequestOperation!,error: NSError!) in
print("Error: " + error.localizedDescription)
})
}
}
【问题讨论】:
标签: ios xcode swift swift2 afnetworking-2