NSArray writeFileToPath failing
I'm having trouble tracking down the problem with writing an array of
NSDictionary objects to a file.
Each key in the NSDictionary objects are NSStrings, as are the values. So
the array should be writable to a plist as the documentation states is
necessary. Anyway, here's my code:
BOOL success = [representations writeToFile:[self
filePathForCacheWithCacheID:cacheID] atomically:YES];
//success is NO
the filePath method looks like this:
+ (NSString *)filePathForCacheWithCacheID:(NSString *)cacheID
{
NSURL *cachesDirectory = [[[NSFileManager defaultManager]
URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask]
lastObject];
return [[cachesDirectory URLByAppendingPathComponent:cacheID]
absoluteString];
}
and the cacheID is the string "objects".
What could be going wrong here?
Thanks!
No comments:
Post a Comment