首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >向LSApplicationQueriesSchemes添加了方案,但canOpenURL仍然失败

向LSApplicationQueriesSchemes添加了方案,但canOpenURL仍然失败
EN

Stack Overflow用户
提问于 2019-12-17 08:18:42
回答 1查看 1.6K关注 0票数 4

请帮帮我!为什么我仍然不被允许查询方案,尽管方案包括在LSApplicationQueriesSchemes中?

我的班级:

代码语言:javascript
复制
class LearningBotScreen: UIViewController {

    @IBAction func googleAssistantOpenButtonPressed(_ sender: Any) {
        let googleAssistantUrl = URL(string:"youtube://")!

        if UIApplication.shared.canOpenURL(googleAssistantUrl){
            print("opening");
            UIApplication.shared.open(googleAssistantUrl)
            /*UIApplication.shared.open(googleAssistantUrl!, options:[:], completionHandler: nil)*/
        }
        else{
            print("download app")
            UIApplication.shared.open(URL(string: "http://apps.apple.com/sg/app/id1220976145")!, options: [:], completionHandler: nil)
            }


}

我的info.plist

代码语言:javascript
复制
    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0">
    <dict>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>instagram</string>
        <string>youtube</string>
    </array>
    <key>LSApplicationCategoryType</key>    <string></string>    
    <key>CFBundleExecutable</key>   <string>$(EXECUTABLE_NAME)</string>      
    <key>CFBundleIdentifier</key>   <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>    
    <key>CFBundleInfoDictionaryVersion</key>    <string>6.0</string>     
    <key>CFBundleName</key>     <string>$(PRODUCT_NAME)</string>     
    <key>CFBundlePackageType</key>  <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>      
    <key>CFBundleShortVersionString</key>   <string>1.0</string>     
    <key>CFBundleVersion</key>  <string>1</string> </dict> </plist>

2019-12-17 15:58:08.426142+0800 drmor斐us1000:203271 -canOpenURL:-canOpenURL:"youtube://“-错误:”此应用程序不允许查询计划youtube“下载应用

EN

回答 1

Stack Overflow用户

发布于 2019-12-17 10:43:02

您已经编辑了属于UI测试目标的info.plist,而不是应用程序目标。将LSApplicationQueriesSchemes条目添加到应用程序的info.plist中。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59370075

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档