繁体   English   中英

如何从我的 iOS 应用程序启动 Apple Pages 文档?

[英]How do I launch an Apple Pages document from my iOS application?

我的 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 文档?? 我希望这有帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM