am working over an iOS App and am having a huge bad time over this issue, here is the thing:
1.- Am creating a file based on some NSData 2.- Am trying to retrieve the NSURL of that new file that i just created
the issue is that the NSURL doesn't seems to find the file, which i have attempt to create with two different methods
NSdata * fileData = /*Gets the data of the file from the web*/
if([fileData writeToFile:databasePath atomically:YES])
{
NSLog(@"path to resource :%@", [[[NSBundle mainBundle] pathForResource:@"myTMP" ofType:@"epub"] description]);
//This causes an exception cause the string is Nil but means that the file is created
return [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"myTMP" ofType:@"epub"]];
}
if i try this:
NSString* path=@"myTMP.epub";
[fileData writeToFile:path options:NSDataWritingAtomic error:&error];
NSLog(@"Write returned error: %@", [error localizedDescription]);
it never creates the new file, any help, suggestions, comments will be very appreciated best regards,
Jorge.