This is purely a curiosity item — the solution turned out to be to check the return value instead of the error — but this code is months old, and that particular section hasn’t been a problem in the past (possibly related to the fact that this code only runs on the first-run of the app?).
I have a section of code where I copy a file from the bundle to the documents directory (a copy of JQuery for some html documents to use). The copy succeeds, but there is in fact an error returned (cocoa error 4, could not complete). Why would the function provide me with an error when it has, in fact, successfully completed?
I’m curious, at least in part, because I suspect that this indicates some major misunderstanding on my part as to how I should handle error files.
I have seen a lot of example code that checks if there is a nil reference for the error: argument to determine if the method was successful, this is wrong! Apple warns in the Error Handling in Cocoa Documentation that this isn’t the documented behavior. You must first check the return value of the method, if it returns an error indication you can then check the NSError reference to learn more about the error.