August 07, 2018
Fixing Ionic iOS build fails with ‘edit-config’ tag in config.xml

Since iOS 10, it’s mandatory to provide a usage description in the info.plist when trying to access privacy-sensitive data such as the user’s contact list or camera. According to majority of the documentation for the plugins, you need to add a edit-config tag to the config.xml file for each permission.

<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
 <string>need camera access to take pictures</string>

By adding the above snippet to the config.xml, it will prompt the user to allow access to the camera for taking pictures. However, after adding it and running the iOS build command, I received an very non-descriptive, unhelpful error.

... TypeError: doc.find is not a function

The only solution I found after spending hours digging for an answer and trying every trick I could think of was to completely remove the iOS platform from the app and reinstall it after adding the edit-config elements.

  1. Remove iOS platform: cordova platform remove ios
  2. Add the edit-config snippets to the <platform name="ios"> element
  3. Run the iOS prepare command: ionic cordova prepare ios

Voilà! I never thought I’d be happier to see a successful build.

Copyright © 2022 Allan Kiezel – Long Island Web Designer & App Developer. All rights reserved.