NSString stringWithContentsOfFile failing with what seems to be the wrong error code

后端 未结 6 1894
闹比i
闹比i 2021-02-12 22:33

I\'m trying to load a file into a string. Here is the code I\'m using:

NSError *error = nil;
NSString *fullPath = [[NSBundle mainBundle] pathForResource:filename         


        
6条回答
  •  南方客
    南方客 (楼主)
    2021-02-12 22:52

    The error is almost certainly that your file is not in UTF-8, but you're right, that does sound like a bug in the error report.

    Open the eula file up with BBEdit (or the free TextWrangler) and see what encoding it uses. Change the encoding to UTF-8 and save it. Diff the two files to see what differences have appeared. Replace the original file with the new one (fixing any glitches).

    If that resolves the problem, then use the Apple Bug Reporter to report the bug in the error report.

提交回复
热议问题