0
我收到以下錯誤消息。我的XCode版本7.1,Swift AFNetworking POST錯誤
/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)
})
}
}
謝謝jervine10 –
如何將responseObject存儲在NSData或NSArray中? – bhadresh