我試圖將URL轉換爲String用下面的代碼:stringWithContentsOfURL返回(空)
NSURL *urlOfOpenedFile = _service.myURLRequest.URL;
NSString *fileThatWasOpened = [NSString stringWithContentsOfURL:urlOfOpenedFile encoding:NSASCIIStringEncoding error:nil];
NSLog(@"url: %@", urlOfOpenedFile);
NSLog(@"string: %@", fileThatWasOpened);
這將返回:
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)
誰能告訴我如何將URL轉換到一個字符串?謝謝。