适用于KMZ / Google Earth iOS App的LSApplicationQueriesSchemes

时间:2017-06-24 19:42:47

标签: ios google-earth kmz

我的iOS应用中有一个KMZ文件。我试图在iOS Google地球应用中打开它。我无法找出正确的网址方案。

查看" Google地球7.1.6.ipa"通过iTunes下载,我发现softwareVersionBundleId是:

com.google.b612

我将以下LSApplicationQueriesSchemes添加到info.plist:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>file</string>
    <string>comgoogleb612</string>
</array>

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

-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.)"

1 个答案:

答案 0 :(得分:0)

comgoogleb612file不是Google地球定义的网址计划。

Google地球应用在其Info.plist中包含以下相关信息:

<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网址方案来启动Google地球。

但更好的方法是使用UIActivityViewControllerUIDocumentInteractionController并让用户选择他们想要对KMZ文件执行的操作。