I’m trying to convert a URL to a String with the following code:
NSURL *urlOfOpenedFile = _service.myURLRequest.URL;
NSString *fileThatWasOpened = [NSString stringWithContentsOfURL:urlOfOpenedFile encoding:NSASCIIStringEncoding error:nil];
NSLog(@"url: %@", urlOfOpenedFile);
NSLog(@"string: %@", fileThatWasOpened);
This returns:
url: file://localhost/Users/User/Library/Application%2520Support/iPhone%2520Simulator/6.0/Applications/72AA03A1-3967-4F22-9745-0722C8DE9FAC/Documents/downloads/My%20Document%20.pdf
string: (null)
Can anyone tell me how to convert the URL to a string? Thanks.
you can use like
NSString *fileThatWasOpened = [NSString stringWithFormat:@"%@", url];