Re: Can't delete file on device

2012-03-28 Thread Jens Alfke
On Mar 27, 2012, at 1:50 PM, Rick Mann wrote: if ([fm fileExistsAtPath: url.absoluteString]) This line seems wrong. It should be using the .path property instead of .absoluteString. The latter is the entire URL, including the scheme and the colon, which is not going to be a real

Re: Can't delete file on device

2012-03-28 Thread Rick Mann
On Mar 28, 2012, at 17:21 , Jens Alfke wrote: On Mar 27, 2012, at 1:50 PM, Rick Mann wrote: if ([fm fileExistsAtPath: url.absoluteString]) This line seems wrong. It should be using the .path property instead of .absoluteString. The latter is the entire URL, including the scheme and

Re: Can't delete file on device

2012-03-28 Thread Charles Srstka
On Mar 28, 2012, at 7:21 PM, Jens Alfke wrote: On Mar 27, 2012, at 1:50 PM, Rick Mann wrote: if ([fm fileExistsAtPath: url.absoluteString]) This line seems wrong. It should be using the .path property instead of .absoluteString. Or better yet, just use the (unfortunately verbosely

Re: Can't delete file on device

2012-03-27 Thread Mike Abdullah
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:

Re: Can't delete file on device

2012-03-27 Thread Rick Mann
Yet, I check for the existence of the file before to verify its there, as you can see in the output. Sent from my iPhone On Mar 27, 2012, at 11:15, Mike Abdullah cocoa...@mikeabdullah.net wrote: Well error code 4 is NSFileNoSuchFileError. I think you're trying to delete a file that doesn't

Re: Can't delete file on device

2012-03-27 Thread Roland King
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

Re: Can't delete file on device

2012-03-27 Thread Mike Abdullah
Show us some code. 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,

Re: Can't delete file on device

2012-03-27 Thread Rick Mann
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

Re: Can't delete file on device

2012-03-27 Thread David Duncan
On Mar 27, 2012, at 1:50 PM, Rick Mann wrote: NSURL* url = [NSURL URLWithString: ci.diskURI]; Does ci.diskURI include the file:// prefix or is it just a path? If the latter, then you should be using +fileURLWithString:. -- David Duncan ___

Re: Can't delete file on device

2012-03-27 Thread Conrad Shultz
On 3/27/12 1:50 PM, Rick Mann wrote: 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); }

Re: Can't delete file on device

2012-03-27 Thread Rick Mann
On Mar 27, 2012, at 14:16 , Conrad Shultz wrote: As David already pointed out you should probably be using file URLs. I made that change, and it behaves the same way. Even so, I don't see why that particular difference would allow it to work on the sim and not on the device. There are a

Re: Can't delete file on device

2012-03-27 Thread Kyle Sluder
On Mar 27, 2012, at 2:23 PM, Rick Mann wrote: On Mar 27, 2012, at 14:16 , Conrad Shultz wrote: As David already pointed out you should probably be using file URLs. I made that change, and it behaves the same way. Even so, I don't see why that particular difference would allow it to

Re: Can't delete file on device

2012-03-27 Thread Gregory Weston
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? Not necessarily. The problem with patterns like check if transient

Re: Can't delete file on device

2012-03-27 Thread Wade Tregaskis
Okay, I made that change, but it seems blatantly incorrect to create an error return if it is also going to return true. It only returns you something if it says it did, by indicating that an error occurred. Otherwise, the contents of the error parameter are undefined. There are definitely

Re: Can't delete file on device

2012-03-27 Thread Mike Abdullah
On 27 Mar 2012, at 22:23, Rick Mann wrote: There are a couple other issues: 1) You shouldn't handle errors by testing (err != nil). This might work (since you initialized err to nil) assuming that removeItemAtURL: isn't fiddling with err anyway, but it's not guaranteed. The preferred

Can't delete file on device

2012-03-26 Thread Rick Mann
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