Note that there are some explanatory texts on larger screens.

plurals
  1. PONSdata writeToURL not working
    primarykey
    data
    text
    <p>i'm trying to save a NsData file into a directory. that is the code of my method:</p> <pre><code>- (void)cacheImage:(NSData *)imageData withTitle:(NSString *)title { NSURL *cacheURL = (NSURL *)[[self.fileMenager URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask] objectAtIndex:0]; //we take the URL of the cache Directory and comvert the url of the cache directory into a string NSURL *imageFolder = [cacheURL URLByAppendingPathComponent:PHOTO_CACHE_FOLDER]; if ([self.fileMenager isWritableFileAtPath:[cacheURL path]]) { //check if the cache directory is writable if (![self.fileMenager createDirectoryAtURL:cacheURL withIntermediateDirectories:NO attributes:nil error:nil]) { //check if the directory of our image is already exist NSURL * fileToWrite = [[imageFolder URLByAppendingPathComponent:title isDirectory:NO] URLByAppendingPathExtension:@"jpg"]; //take the complete url of image if ([imageData writeToURL:fileToWrite atomically:YES]) //atomically = safe write { NSArray *debug = [self.fileMenager contentsOfDirectoryAtPath:[imageFolder path] error:nil]; for (NSURL *url in debug) NSLog(@"url prooooo : %@",url); } } } } </code></pre> <p>that is an example of url (fileToWrite) where i try to write:</p> <pre><code>file://localhost/Users/MarcoMignano/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/93B0A0AC-EC13-4050-88CA-F46FBA11001E/Library/Caches/image_cache/Mozart%201.jpg </code></pre> <p>the point is simple, the method writeToURL return NO, i can't understand why, the url looks correct.</p> <p>somebody can help my' thank you. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload