Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova iOS build fails with 'edit-config' tag

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.

like image 610
S. Hines Avatar asked Jan 02 '18 17:01

S. Hines


1 Answers

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

like image 132
Alon Rosenfeld Avatar answered Oct 05 '22 03:10

Alon Rosenfeld