gpt4 book ai didi

ios - 如何从 iOS 应用程序启动 Apple Pages 文档?

转载 作者:行者123 更新时间:2023-11-29 05:08:14 33 4
gpt4 key购买 nike

我的 iOS 应用程序包中有一个页面文档。我想直接使用 Apple 的 Pages iOS 应用程序打开此文档。我知道我必须在 LSApplicationQueriesSchemes 下的 info.plist 中添加方案。但我真的只是猜测我应该添加什么。我尝试过“pages”//”和“com.apple.pages://”,但这些都不起作用。

如果我尝试 MS Word,它会起作用!

UIApplication.shared.open(URL.init(string: "word://hello.doc")!, options: [: ]) { (result) in
print(result)
}

当我尝试时:

UIApplication.shared.canOpenURL(URL.init(string: "pages://hello.pages")!)

我收到以下错误:

canOpenURL: failed for URL: "pages://hello.pages" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

当我谷歌这个错误代码时,我发现它意味着kLSApplicationNotFoundErr。是否可以通过这种方式打开 .pages 文档?或者你必须使用 UIDocumentInteractionController 吗?

最佳答案

获取链接到 URL 的按钮的代码是...

@IBAction func linkTapped(_ sender: UIButton) {
if let url = NSURL(string:
"https://www.radiusapp.co/blog/end-user-license-
agreement"){
UIApplication.shared.open(url as URL)
}
}

由于您在技术上链接到 URL,因此我相信这应该可行。如果没有,可以选择链接到 Google 文档吗?我希望这有帮助!

关于ios - 如何从 iOS 应用程序启动 Apple Pages 文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59955745/

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