Cordova iOS build fails with 'edit-config' tag

六眼飞鱼酱① 提交于 2019-12-07 05:35:46

问题


I have an Ionic 3 app (Ionic CLI 3.19.0, Cordova CLI 8.0.0, android platform 7.0.0, ios platform 4.5.4) that includes the native 'Geolocation' plugin. Since iOS 10+ requires the NSLocationWhenInUseUsageDescription property in the App-Info.plist file, the plugin's documentation (Geolocation iOS Quirks) says to include the following in the config.xml:

<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
   <string>need location access to find things nearby</string>
</edit-config>

So I added that verbatim as the first entry within <platform name="ios">...</platform> tag of my config.xml.

During the cordova iOS stage of the build, it fails with the following obscure errors:

(node:60604)UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: doc.find is not a function

(node:60604) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


回答1:


As mentioned in the comment above, the steps needed are:

  • Remove platforms ios: cordova platform remove ios
  • Add the edit-config into platform name="ios" tag

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

  • Run prepare ios: ionic cordova prepare ios




回答2:


and set it in the right format

<edit-config parent="NSLocationWhenInUseUsageDescription" target="*-Info.plist">
    <string>need location access to to order a driver to the current location</string>
</edit-config>


来源:https://stackoverflow.com/questions/48065189/cordova-ios-build-fails-with-edit-config-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!