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

前端 未结 5 1014
无人及你
无人及你 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:47

    If you are trying to access a remote url via HTTP and using XCode 7 or later you may get a NSCocoaErrorDomain returned from [NSData dataWithContentsOfURL:].

    The root cause of this may actually be your "App Transport Security Settings". By default iOS doesn't allow arbitrary loading of URLS.

提交回复
热议问题