我的iOS应用程序中有一个KMZ文件。我正试着在iOS的谷歌地球应用中打开它。我找不出正确的URL方案。
查看iTunes下载的"Google Earth 7.1.6.ipa“,我发现softwareVersionBundleId是:
com.google.b612我在info.plist中添加了以下LSApplicationQueriesSchemes:
<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.)"发布于 2017-06-25 06:09:15
comgoogleb612和file不是谷歌地球定义的网址方案。
谷歌地球应用程序的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键下列出的值。
鉴于此,我将使用comgoogleearthz或kmz URL方案来启动Google Earth。
但是更好的方法是使用UIActivityViewController或UIDocumentInteractionController,让用户选择他们想要对KMZ文件做什么。
https://stackoverflow.com/questions/44740322
复制相似问题