我正在使用AFNetworking從openweathermap API中檢索天氣信息。當使用AFNetworking時,指示'Anyobject'不是'NSProxy'的子類型
let manager = AFHTTPSessionManager()
manager.requestSerializer = AFJSONRequestSerializer()
let url = "http://api.openweathermap.org/data/2.5/weather"
let params = ["lat": latitude,"lon": longitude,"cnt": 0]
manager.get(url, parameters: params,
success: {(operation: URLSessionDataTask,responseObject: AnyObject!) in print("JSON" + responseObject.description!) },
failure: {(operation: URLSessionDataTask?,error: Error) in print(error.localizedDescription)}
)
在responseObject.description
突出表明「Anyobject」不是「NSProxy」 亞型如果除去.description
錯誤就會消失。 平臺:Xcode的8.3.2迅速:3
'Anyobject' is not a subtype of 'NSProxy'