8

When I open a URL (like this http://webserver/index.php/feeds/1.2/3.4/5/1000/) in my app via Xcode I get a nil JSON string returned. It doesn't even seem to be talking to the server.

The exact same URL works when I paste it into a browser.

Reading up on similar problems, I tried restarting my Mac and iPhone but I get the same problem.

e.g. looking at the error object I see:

Error Domain=NSCocoaErrorDomain Code=256 "The file “1000” couldn’t be opened." UserInfo={NSURL=http://webserver/index.php/feeds/1.2/3.4/5/1000/} 

The webserver does not show any entries in the logs (it does if I paste the URL in the browser) when I'm running the app and go past that line of code.

==== UPDATE

I'm assuming it's something to do with this NSURLSession/NSURLConnection HTTP load failed on iOS 9

However, after adding the webservice domain to the plist (under NSExceptionDomains) I get a crash in CJSONDserializer in this method:

- (id)deserializeAsDictionary:(NSData *)inData error:(NSError **)outError;
{
if (inData == NULL || [inData length] == 0)

as follows:

Thread 4: EXC_BAD_ACCESS (code=1,address=0x10)

and, after updating TouchJSON, I now have a crash here:

if (theData.length >= 4)

==== UPDATE 2

Interestingly, if I click the QuickLook icon in Xcode whilst on the breakpoint, it loads up the content just fine. And I can see a request at the server.

Any suggestions?

Community
  • 1
  • 1
Snowcrash
  • 80,579
  • 89
  • 266
  • 376
  • The error is NSFileReadUnknownError. That's not a file URL. How, exactly, is your code trying to open this URL? – dgatwood Dec 04 '15 at 09:02
  • 1
    The EXC_BAD_ACCESS is a NULL pointer dereference. Your theData object is getting deallocated in one thread while you're accessing it in another. I can't tell you how or why that is happening, but that's what's happening there. – dgatwood Dec 04 '15 at 09:03

0 Answers0