NSData dataWithContentsOfURL: not returning data for URL that shows in browser

前端 未结 5 1023
无人及你
无人及你 2020-12-18 16:10

I am making an iOS client for the Stack Exchange API. After a long, drawn out fight I finally managed to implement authentication - which gives me a token I stick into a URL

5条回答
  •  心在旅途
    2020-12-18 16:46

    Your URL might be having a space that's why it returns nil.Just replace the space in URL with a '+' :

    stringByReplacingOccurrencesOfString:@" " withString:@"+"
    

提交回复
热议问题