Convert ImagePath in DocumentDirectory to NSURL Iphone
I am using following code
NSArray *paths =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,
YES);
NSURL *myUrl = [[NSURL alloc]
initWithString:self.selectedRing.ringThumbNailImagePath];
[Utilities responseDataFromURL:myUrl completionBlock:^(NSData *fileData,
NSError *err)
{
if (err != nil)
{
[self.indicator stopAnimating];
[Utilities errorDisplay:@""];
}
else
{
NSString *filePath = [[paths objectAtIndex:0]
stringByAppendingPathComponent:@"Test.igo"];
NSLog(@"FilePath: %@", filePath);
if ([fileData writeToFile:filePath atomically:YES])
{
CGRect rect = CGRectMake(0 ,0 , 0, 0);
NSURL *igImageHookFile = [[NSURL alloc]
initWithString:[[NSString alloc] initWithFormat:@"file://%@",
filePath]];
NSLog(@"JPG path %@", filePath);
filePath is
Users/umar/Library/Application Support/iPhone
Simulator/6.1/Applications/B45223CF-B437-4617-A02D-DCA91C965A5A/Documents/Test.igo
however i get Nil igImageHookFile NSURL. What is wrong?
No comments:
Post a Comment