gpt4 book ai didi

iphone - iOS开发: Saved file does not show up in itunes

转载 作者:行者123 更新时间:2023-12-03 20:00:27 26 4
gpt4 key购买 nike

当我使用 URL 将 PDF 保存到文件时,保存的 pdf 不会显示在 Itunes/我的 iPad 名称/Apps/MyApp 的文档窗口中。实际上,我什至在文件共享部分下看不到我的应用程序。像“dropbox”或“pages”这样的应用程序是如何做到这一点的?

使用的代码
//我想要的pdf的url
NSURL *pdfURL = [NSURL URLWithString:@"http://manuals.info.apple.com/en/iphone_user_guide.pdf"];

//获取我们的文档目录的路径
NSArray *documentPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

//这应该是我们的文档目录
NSString *saveDirectory = [documentPath objectAtIndex:0];<br/>
NSString *saveDirectory2 = [[saveDirectory stringByAppendingPathComponent:@"myfile.pdf"] retain];

//将我的 PDF 转换为 NSData,也许我无法从 PDF 转换?
NSData *dataToWrite = [NSData dataWithContentsOfURL:pdfURL];

//将转换后的pdf写入内存中的路径
BOOL status = [dataToWrite writeToFile:saveDirectory2 atomically:YES];

最佳答案

您是否已按照此处的说明将 UIFileSharingEnabled 键添加到应用的 Info.plist 文件并将其值设置为 YES?:

http://developer.apple.com/library/ios/#documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html%23//apple_ref/doc/uid/TP40009252-SW20

没有它,iTunes 将看不到您应用的文档目录中的内容。

关于iphone - iOS开发: Saved file does not show up in itunes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4108410/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com