swift - Google url shortener iOS -


trying short version of url using googleshortener api. using afnetworking 3.0 , error: 'anyobject not subtype of 'nsproxy'

let manager = afhttpsessionmanager()     manager.requestserializer = afjsonrequestserializer()     let params = ["longurl": "myurl"]       manager.post("https://www.googleapis.com/urlshortener/v1/url?key=mykey", parameters: params, success: {(operation: nsurlsession!,responseobject: anyobject!) in         println("json" + responseobject.description)         },                    failure: { (operation: nsurlsession!,error: nserror!) in         println("error while requesting shortened: " + error.localizeddescription)     }) 

it highlighted on line 'println("json" + responseobject.description)' on begging of 'description'.

i had same error while using afnetworking 3. documentation indicated there changes. however, here code able run. hope works out.

let manager = afhttpsessionmanager() manager.requestserializer = afjsonrequestserializer() let params = ["longurl": "myurl"]   manager.post("https://www.googleapis.com/urlshortener/v1/url?key=mykey", parameters: params, success: {(operation: nsurlsessiondatatask!,responseobject: anyobject?) in     print("json" + (responseobject?.description)!)     },                failure: { (operation: nsurlsessiondatatask?,error: nserror) in     print("error while requesting shortened: " + error.localizeddescription) }) 

Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -