Re: removeItemAtPath in 10.7
Re: removeItemAtPath in 10.7
- Subject: Re: removeItemAtPath in 10.7
- From: Conrad Shultz <email@hidden>
- Date: Wed, 26 Aug 2015 09:45:35 -0700
> On Aug 26, 2015, at 8:11 AM, sqwarqDev <email@hidden> wrote:
>
> I built my app in Xcode 6.4 on 10.10.5.
>
> Runs without issue on Yosemite and Mavericks. However, when I boot into Lion 10.7, I get an “unrecognized selector” error on the “removeItemAtPath” line. Here’s the snippet"
>
> NSError *err;
> int i;
> for (i=0; i < offendersList.count; i++)
> {
>
> NSString *thisPath = offendersList[i];
>
> [[NSFileManager defaultManager] removeItemAtPath:thisPath error:&err];
>
> if (!err)
> {
> //blah blah
>
> Anybody got any idea why this is objectionable in Lion but not in Mavericks +? The headers indicate removeItemAtPath is good to go from 10.5 onwards.
It’s not immediately obvious to me why you’d get such an error. Could you post the actual error and backtrace?
Note, though, that it is incorrect to check for errors in this manner. In Cocoa, the value of the error out parameter is not guaranteed in the success case. You should test the return value of -removeItemAtPath:error: (or, better yet, -removeItemAtURL:error:) and, only if the value is NO, then inspect the error.
-Conrad
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden