Encoding issue: Cocoa Error 261?

后端 未结 5 689
耶瑟儿~
耶瑟儿~ 2021-02-12 14:01

So I\'m fetching a JSON string from a php script in my iPhone app using:

NSURL *baseURL = [NSURL URLWithString:@\"test.php\"];
NSError *encodeError = [[NSError a         


        
5条回答
  •  太阳男子
    2021-02-12 15:00

    Don't know if this is your problem, but I just had a similar thing (stringWithContentsOfFile, no JSON), and the problem was that the file had CRLF (windows) line-endings and Western-whatever-it's-called encoding. I used SubEthaEdit to convert to LF (Mac/Unix line-endings) and UTF-8 encoding, and now everything works fine.

提交回复
热议问题