Tag: nsdata

+ URLWithString:返回nil

我使用QLPreviewController查看单词,Excel,PDF等问题是文件在服务器中,所以我需要从某个URL下载。 我正在使用这个代码: NSURL *dLurl = [NSURL URLWithString:[NSString stringWithFormat:@"%@",DLPathStr]]; NSData *data = [NSData dataWithContentsOfURL:dLurl]; 用于下载文件,它适用于PDF文件,但在Word和Excel文件不起作用我无法下载任何东西。

UIDocumentInteractionController“无效的scheme(null)”

我正在尝试使用UIDocumentInteractionController预览文档。 该文件是我的应用程序从网上下载的.xls文件。 我不断收到这个错误: 'UIDocumentInteractionController: invalid scheme (null). Only the file scheme is supported.' 我使用下面的代码: – (void) webServiceController:(WebServiceController *)webServiceController returnedArray:(NSMutableArray *)array { if ([webServiceController.webRequest isEqualToString: @"generateExcelFileForEmployee"]) { // start previewing the document at the current section index NSString *link = [[NSString stringWithString:array[0]] stringByReplacingOccurrencesOfString:@"AdminFunctions.php" withString:@"AdminFunctions.xls"]; link = [[[link stringByReplacingOccurrencesOfString:@"\\" withString:@""]stringByReplacingOccurrencesOfString:@"/public/sites/" withString:@"http://"]stringByReplacingOccurrencesOfString:@"\"\\\"" withString:@""]; NSLog(@"%@", link); NSData *urlData = […]