Ios Swift AFPOST错误
我得到以下错误。我的XCode版本7.1 /Users/chamath/Desktop/SwiftNvoi/Mobile/Mobile/APISFAuthentication.swift:30:22:无法将类型为“(AFHTTPRequestOperation!,NSError!)->()”的值转换为预期的参数类型“((AFHTTPRequestOperation?,NSError)->Void)?”Ios Swift AFPOST错误,ios,xcode,swift,swift2,afnetworking-2,Ios,Xcode,Swift,Swift2,Afnetworking 2,我得到以下错误。我的XCode版本7.1 /Users/chamath/Desktop/SwiftNvoi/Mobile/Mobile/APISFAuthentication.swift:30:22:无法将类型为“(AFHTTPRequestOperation!,NSError!)->()”的值转换为预期的参数类型“((AFHTTPRequestOperation?,NSError)->Void)?” 在块中填充参数时,不需要指定类类型。如下所示更新参数: func fAuthenticateU
在块中填充参数时,不需要指定类类型。如下所示更新参数:
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, responseObject) in
print("JSON: " + responseObject.description)
},
failure: { (operation, error) in
print("Error: " + error.localizedDescription)
})
}
在块中填充参数时,不需要指定类类型。如下所示更新参数:
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, responseObject) in
print("JSON: " + responseObject.description)
},
failure: { (operation, error) in
print("Error: " + error.localizedDescription)
})
}
如何在NSData或NSArray中存储responseObject?如何在NSData或NSArray中存储responseObject?