Re: Can't delete file on device
Re: Can't delete file on device
- Subject: Re: Can't delete file on device
- From: Rick Mann <email@hidden>
- Date: Tue, 27 Mar 2012 13:50:25 -0700
On Mar 27, 2012, at 12:05 , Mike Abdullah wrote:
> Show us some code.
NSURL* url = [NSURL URLWithString: ci.diskURI];
if ([fm fileExistsAtPath: url.absoluteString])
{
NSLog(@"File exists: %@", url.absoluteString);
}
NSError* err = nil;
[fm removeItemAtURL: url error: &err];
if (err != nil)
{
NSLog(@"Unable to delete file at %@: %@\n%@", url, err, err.userInfo);
}
>
> On 27 Mar 2012, at 19:47, Rick Mann wrote:
>
>> The file is generated and deleted by code; it's the same string passed around, at least certainly in the existence check just before the attempted delete. Surely that existence check would fail, too?
>>
>> --
>> Rick
>>
>> On Mar 27, 2012, at 11:31 , Roland King wrote:
>>
>>> and the fact it works on the sim and not on the device makes me think you have a case issue, device is case sensitive, sim is not.
>>>
>>> On Mar 28, 2012, at 2:15 AM, Mike Abdullah wrote:
>>>
>>>> Well error code 4 is NSFileNoSuchFileError. I think you're trying to delete a file that doesn't exist!
>>>>
>>>> On 27 Mar 2012, at 03:22, Rick Mann wrote:
>>>>
>>>>> I'm trying to delete some image files I cache. Here's what I'm getting:
>>>>>
>>>>> 2012-03-26 19:20:14.330 MyApp[5765:707] File exists: /var/mobile/Applications/6BBF21B1-97B3-4016-88B0-FE1C18D736D7/Library/Caches/Images/4149/5414582865_932fac9c82_b.jpg
>>>>>
>>>>> 2012-03-26 19:20:14.332 MyApp[5765:707] Unable to delete file at /var/mobile/Applications/6BBF21B1-97B3-4016-88B0-FE1C18D736D7/Library/Caches/Images/4149/5414582865_932fac9c82_b.jpg: Error Domain=NSCocoaErrorDomain Code=4 "The operation couldn’t be completed. (Cocoa error 4.)" UserInfo=0x278590 {NSURL=/var/mobile/Applications/6BBF21B1-97B3-4016-88B0-FE1C18D736D7/Library/Caches/Images/4149/5414582865_932fac9c82_b.jpg}
>>>>> {
>>>>> NSURL = "/var/mobile/Applications/6BBF21B1-97B3-4016-88B0-FE1C18D736D7/Library/Caches/Images/4149/5414582865_932fac9c82_b.jpg";
>>>>> }
>>>>>
>>>>> This doesn't happen in the simulator. Xc4.3.2, iOS 5.1 9B176
>>>>
>>>> _______________________________________________
>>>>
>>>> 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
>>>
>>
>>
>> _______________________________________________
>>
>> 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
>
_______________________________________________
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