首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用于KMZ /谷歌地球iOS应用程序的LSApplicationQueriesSchemes

用于KMZ /谷歌地球iOS应用程序的LSApplicationQueriesSchemes
EN

Stack Overflow用户
提问于 2017-06-25 03:42:47
回答 1查看 334关注 0票数 0

我的iOS应用程序中有一个KMZ文件。我正试着在iOS的谷歌地球应用中打开它。我找不出正确的URL方案。

查看iTunes下载的"Google Earth 7.1.6.ipa“,我发现softwareVersionBundleId是:

代码语言:javascript
复制
com.google.b612

我在info.plist中添加了以下LSApplicationQueriesSchemes:

代码语言:javascript
复制
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>file</string>
    <string>comgoogleb612</string>
</array>

当我尝试打开KMZ文件时,收到以下错误消息:

代码语言:javascript
复制
-canOpenURL: failed for URL: "file:///var/mobile/Containers/Data/Application/537CF335-3DA5-46E0-A671-169645593E38/Documents/apps/google_earth_tour.kmz" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

-canOpenURL: failed for URL: "comgoogleb612:///var/mobile/Containers/Data/Application/537CF335-3DA5-46E0-A671-169645593E38/Documents/apps/google_earth_tour.kmz" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-06-25 06:09:15

comgoogleb612file不是谷歌地球定义的网址方案。

谷歌地球应用程序的Info.plist中包含以下相关信息:

代码语言:javascript
复制
<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>CFBundleURLName</key>
        <string>geo</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>comgoogleearthgeo</string>
            <string>geo</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>CFBundleURLName</key>
        <string>com.google.b612</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>comgoogleearth</string>
            <string>kml</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>CFBundleURLName</key>
        <string>com.google.b612.kmz</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>comgoogleearthz</string>
            <string>kmz</string>
        </array>
    </dict>
</array>

应用程序定义的自定义方案是在CFBundleURLSchemes键下列出的值。

鉴于此,我将使用comgoogleearthzkmz URL方案来启动Google Earth。

但是更好的方法是使用UIActivityViewControllerUIDocumentInteractionController,让用户选择他们想要对KMZ文件做什么。

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

https://stackoverflow.com/questions/44740322

复制
相关文章

相似问题

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