gpt4 book ai didi

ios - 在 iBook 中打开名称中包含空格的 PDF

转载 作者:行者123 更新时间:2023-11-28 22:56:32 25 4
gpt4 key购买 nike

我已经在我的 PDF 查看器中实现了已经讨论过第 n 次的在 iBook 中打开功能。当 PDF 文件不包含空格时效果很好(example1.pdf、example2.pdf)。当 PDF 的名称中有一些空格(示例 1.pdf)时,单击“在 iBook 中打开”按钮不会执行任何操作。

NSString *fileURL = [(Documents *)(self.detailItem) url];
NSArray *subStrings = [fileURL componentsSeparatedByString:@"/"];
NSString *filePath = [[self documentsDirectory] stringByAppendingPathComponent:[subStrings lastObject]];
docIntController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:filePath]];
docIntController.delegate = self;
docIntController.UTI = @"com.adobe.pdf";

[docIntController presentOptionsMenuFromBarButtonItem:sender animated:YES];

欢迎任何建议。谢谢:)

最佳答案

由于 filePath 字符串是一个 URL,您可能需要通过 NSString -stringByAddingPercentEscapesUsingEncoding: 运行它在调用 fileURLWithPath:

之前

关于ios - 在 iBook 中打开名称中包含空格的 PDF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10677021/

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