Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No success with createFileAtPath ("No such process")

I'm having a problem saving some data to file. The following line returns a NO:

[self.fileManager createFileAtPath:fileString contents:photoData attributes:nil];

The error code is 3 and the error message is "No such process." The fileString variable points to a filename (e.g., "file://localhost/var/mobile/Applications/... /Library/Caches/photos/2-86290") and photoData is an NSData variable (though a mouseover during debugging tells me it's actually an NSConcreteData variable).

Thanks for reading! Any ideas on this would be terrific.

like image 825
Rogare Avatar asked Dec 20 '25 13:12

Rogare


1 Answers

If fileString begins with file:// then this isn't a path, it is a URL string for a file URL.

If you started with an NSURL object and obtained fileString as follows:

fileString = [someURL absoluteString];

then change it to:

fileString = [someURL path];

Now fileString will have a valid file path that you can pass to the createFileAtPath: method.

Another option, if you want to write the NSData object photoData, is to do:

[photoData writeToURL:someURL atomically:YES];
like image 171
rmaddy Avatar answered Dec 22 '25 02:12

rmaddy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!