Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Usage description issue in Ionic and iOS 10 builds

My ionic application for iOS worked fine, till today when I wanted to make a new build.

This is what get's returned by Apple:

Dear developer,

We have discovered one or more issues with your recent delivery for "AppName". To process your delivery, the following issues must be corrected:

This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.

This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.

Though you are not required to fix the following issues, we wanted to make you aware of them:

Missing Push Notification Entitlement - Your app includes an API for Apple's Push Notification service, but the aps-environment entitlement is missing from the app's signature. To resolve this, make sure your App ID is enabled for push notification in the Provisioning Portal. Then, sign your app with a distribution provisioning profile that includes the aps-environment entitlement. This will create the correct signature, and you can resubmit your app. See "Provisioning and Development" in the Local and Push Notification Programming Guide for more information. If your app does not use the Apple Push Notification service, no action is required. You may remove the API from future submissions to stop this warning. If you use a third-party framework, you may need to contact the developer for information on removing the API.

This are my dependencies:

  • "ngstorage": "~0.3.10",
  • "ion-image-lazy-load": "*",
  • "ngCordova": "~0.1.24-alpha",

And I use the Barcode scanner in ngCordova. So I did this: $ cordova plugin rm phonegap-plugin-barcodescanner $ cordova plugin add phonegap-plugin-barcodescanner --variable CAMERA_USAGE_DESCRIPTION="Scan QR-Codes" --save

The config.xml has this in the bottom now:

 <plugin name="cordova-plugin-camera" spec="~1.2.0">
        <variable name="CAMERA_USAGE_DESCRIPTION" value="description" />
        <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="description" />
    </plugin>
    <plugin name="phonegap-plugin-barcodescanner" spec="https://github.com/phonegap/phonegap-plugin-barcodescanner.git">
        <variable name="CAMERA_USAGE_DESCRIPTION" value="Scan QR-Codes" />
    </plugin>

But still I get the same e-mail from Apple that my app has one or more issues..

like image 973
user1469734 Avatar asked Oct 11 '16 15:10

user1469734


People also ask

Does ionic work on iOS?

Because of this foundation in web technologies, Ionic can run anywhere the web runs — iOS, Android, browsers, PWAs, and more.

Does ionic need Xcode?

Setting up an Ionic 5 appTo create production builds in Android and iOS, it would require Android Studio and XCode respectively. You can install the latest Android Studio from their website. XCode can be installed only on Apple systems.


1 Answers

Although, almost all Cordova plugins are now updated to support user-sensitive usage description. For example, update your barcode plugin version to the latest build (as of November 7th 2016) where they added support for usage description:

<plugin name="phonegap-plugin-barcodescanner" spec="~6.0.3">

But if you don't find a plugin supporting it yet and you need to set the description in *-Info.plist then please YOU NEED TO STOP THERE

Modifying the *-Info.plist for Cordova applications are not recommended because this will require you to save that change which might get overwritten after build process. So as the clean alternative you should use cordova-custom-config.

cordova plugin add cordova-custom-config --save

Why should I use it?

While some platform preferences can be set via Cordova/Phonegap in the config.xml, many (especially ones related to newer platform releases) cannot. One solution is to manually edit the configuration files in the platforms/ directory, however this is not maintainable across multiple development machines or a CI environment where subsequent build operations may overwrite your changes.

This plugin attempts to address this gap by allowing additional platform-specific preferences to be set after the prepare operation has completed, allowing either preferences set by Cordova to be overridden or other unspecified preferences to be set. Since the custom preferences are entered into the config.xml, they can be committed to version control and therefore applied across multiple development machines, CI environments, and maintained between builds or even if a platform is removed and re-added.

Now add the following to your config.xml file under <platform name="ios"> block:

<custom-config-file parent="NSPhotoLibraryUsageDescription" platform="ios" target="*-Info.plist">
    <string>This app needs access to your Photo Library to include a screenshot with feedback foo.</string>
</custom-config-file>
<custom-config-file parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist">
    <string>Allow to scan member's pass</string>
</custom-config-file>

This will automatically add those in your *-Info.plist.

Update 1 (23rd Feb 2018)

If you are using cordova-custom-config plugin version < 5 then replace custom-config-file tag with config-file.

https://github.com/dpa99c/cordova-custom-config#changes-in-cordova-custom-config5

Update 2 (19th Jan 2019)

See this answer for Cordova CLI >= 6:

https://stackoverflow.com/a/38013943/2405040

like image 52
Shashank Agrawal Avatar answered Oct 01 '22 23:10

Shashank Agrawal