Cordova iOS版本使用'edit-config'标记失败

S. *_*nes 5 ios cordova ionic-framework cordova-plugins

我有一个Ionic 3应用程序(Ionic CLI 3.19.0,Cordova CLI 8.0.0,android平台7.0.0,ios平台4.5.4),其中包含原生的"Geolocation"插件.由于iOS 10+需要NSLocationWhenInUseUsageDescriptionApp-Info.plist文件中的属性,因此插件的文档(Geolocation iOS Quirks)表示要在config.xml中包含以下内容:

<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
   <string>need location access to find things nearby</string>
</edit-config>
Run Code Online (Sandbox Code Playgroud)

所以我将verbatim添加为<platform name="ios">...</platform>config.xml标签中的第一个条目.

在构建的cordova iOS阶段,它失败并出现以下模糊错误:

(node:60604)UnhandledPromiseRejectionWarning:未处理的promise promise(拒绝id:1):TypeError:doc.find不是函数

(节点:60604)[DEP0018]弃用警告:不推荐使用未处理的拒绝承诺.将来,未处理的承诺拒绝将使用非零退出代码终止Node.js进程.

小智 10

如上面的评论所述,所需的步骤是:

  • 删除平台ios:cordova平台删除ios
  • edit-config添加到platform name ="ios"标记中

    <platform name="ios"> Add me here </platform>

  • 运行准备ios:离子cordova准备ios