Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从web服务到iPhone的pdf_Iphone - Fatal编程技术网

从web服务到iPhone的pdf

从web服务到iPhone的pdf,iphone,Iphone,如何从服务器下载文件 有没有办法将pdf文件从web服务发送到iPhone 是否需要将pdf转换为其他格式,然后发送并重新转换?您可以使用以下代码轻松下载pdf文件 NSData *pdfData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:downloadUrl]]; //Store the Data locally as PDF File NSString *resourceDocPath = [[NS

如何从服务器下载文件

有没有办法将pdf文件从web服务发送到iPhone


是否需要将pdf转换为其他格式,然后发送并重新转换?

您可以使用以下代码轻松下载pdf文件

NSData *pdfData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:downloadUrl]];

    //Store the Data locally as PDF File

NSString *resourceDocPath = [[NSString alloc] initWithString:[[[[NSBundle mainBundle]  resourcePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Documents"]];
NSString *pdf1;
pdf1 = [NSString stringWithFormat:@"%@.pdf",yourBookTitle];

NSString *filePath = [resourceDocPath stringByAppendingPathComponent:pdf1];

[pdfData writeToFile:filePath atomically:YES];
对于第二个问题,将您的pdf文件存储到服务器并获取Url,无需以任何格式转换