Ionic package not functioning for ios builds with camera, geolocation etc

ionic cordova build ios erases the necessary information in Platforms/iOS/MyApp/info.plist. Cordova doesn’t. I used up 3 versions in iTunes Store because my build didn’t have the necessary info for the use of Camera and Geolocation even as I entered it each time. When I tried cordova build ios, the info.plist wasn’t castrated as with ionic but as ionic package build starts an ionic build first, the necessary information in the info.plist file was erased each time. This is very annoying. It means you can’t use ionic package for an ios app with enough interactive elements to be accepted by the App Store. I’ll now have to use Phonegap to build a working .ipa file. What use is a pro membership with ionic then?

What does that mean?

An Ionic build doesn’t touch any info.plist files. It just transforms src to www.

You are using a membership that is not even available yet but only previewed on the pricing website? Kudos.


What exact commands are you running?
What is your ionic info output?
What does your config.xml and package.json look like?

I have VSC open, Taxoil-Info.pst contains the info for camera, photolibrary and location. With “ionic cordova build ios”, the file in VSC reloads and the the mentioned info has disappeared. With “cordova build ios” the info stays in the file.

It seems to do just that.

On my dashboard, under the app “Taxoil” Current Plan says “PRO”.

The exact command for ionic build is mentioned above.

Ionic info: 

@ionic/cli-utils  : 1.8.1
    ionic (Ionic CLI) : 3.8.1

global packages:

    Cordova CLI : 7.0.1 

local packages:

    @ionic/app-scripts : 2.1.3
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.0

System:

    ios-deploy : 1.9.1 
    Node       : v6.10.3
    npm        : 3.10.10 
    OS         : OS X El Capitan
    Xcode      : Xcode 8.1 Build version 8B62

config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget id="at.taxoil.app2016" version="2.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Taxoil</name>
    <description>Die Fahrer-App von Taxoil.</description>
    <author email="fritzfrei45@gmail.com" href="https://taxoil.at/">Fritz Frei</author>
    <content src="index.html" />
    <access origin="*" />
    <allow-navigation href="http://ionic.local/*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <preference name="webviewbounce" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="android-minSdkVersion" value="16" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="FadeSplashScreenDuration" value="300" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="3000" />
    <platform name="android">
        <allow-intent href="market:*" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
        <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
        <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
        <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
    </platform>
    <engine name="android" spec="^6.2.3" />
    <plugin name="cordova-plugin-camera" spec="^2.4.1">
        <variable name="CAMERA_USAGE_DESCRIPTION" value=" " />
        <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value=" " />
    </plugin>
    <plugin name="cordova-plugin-console" spec="^1.0.5" />
    <plugin name="cordova-plugin-device" spec="^1.1.4" />
    <plugin name="cordova-plugin-email" spec="^1.2.6" />
    <plugin name="cordova-plugin-geolocation" spec="^2.4.3">
        <variable name="GEOLOCATION_USAGE_DESCRIPTION" value=" " />
    </plugin>
    <plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
    <plugin name="cordova-plugin-statusbar" spec="^2.2.2" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
    <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
    <plugin name="mx.ferreyra.callnumber" spec="~0.0.2" />
    <engine name="ios" spec="~4.4.0" />
</widget>

Package.json:

{
    "name": "taxoil",
    "version": "2.3",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.1.3",
        "@angular/compiler": "4.1.3",
        "@angular/compiler-cli": "4.1.3",
        "@angular/core": "4.1.3",
        "@angular/forms": "4.1.3",
        "@angular/http": "4.1.3",
        "@angular/platform-browser": "4.1.3",
        "@angular/platform-browser-dynamic": "4.1.3",
        "@ionic-native/call-number": "^4.1.0",
        "@ionic-native/camera": "^4.1.0",
        "@ionic-native/core": "3.12.1",
        "@ionic-native/email-composer": "^4.1.0",
        "@ionic-native/geolocation": "^4.1.0",
        "@ionic-native/splash-screen": "3.12.1",
        "@ionic-native/status-bar": "3.12.1",
        "@ionic/storage": "2.0.1",
        "call-number": "^1.0.1",
        "cordova-android": "^6.2.3",
        "cordova-ios": "^4.4.0",
        "cordova-plugin-camera": "^2.4.1",
        "cordova-plugin-compat": "^1.1.0",
        "cordova-plugin-console": "^1.0.5",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-email": "^1.2.6",
        "cordova-plugin-geolocation": "^2.4.3",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.2",
        "cordova-plugin-whitelist": "^1.3.1",
        "ionic-angular": "3.6.0",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "mx.ferreyra.callnumber": "~0.0.2",
        "rxjs": "5.4.0",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.12"
    },
    "devDependencies": {
        "@ionic/app-scripts": "2.1.3",
        "@ionic/cli-plugin-cordova": "1.6.2",
        "@ionic/cli-plugin-ionic-angular": "1.4.1",
        "ionic": "3.8.1",
        "typescript": "2.3.4"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-email": {},
            "cordova-plugin-camera": {
                "CAMERA_USAGE_DESCRIPTION": " ",
                "PHOTOLIBRARY_USAGE_DESCRIPTION": " "
            },
            "mx.ferreyra.callnumber": {},
            "cordova-plugin-geolocation": {
                "GEOLOCATION_USAGE_DESCRIPTION": " "
            },
            "cordova-plugin-console": {},
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {}
        },
        "platforms": [
            "android",
            "ios"
        ]
    }
}

Thanks for your help!
Fritz

Ok, I wasn’t aware that this name had be used before.
(You are posting in a community forum here by the way. If you want to talk to Ionic support you will have to contact them directly)

ionic cordova build ios is not an Ionic Package command. I am still not sure what you are actually doing as this doesn’t match your topic title.

I changed your post to format your code or error message correctly. Please use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.

Is this the same information from the .plist that is getting lost?
Does the plist also contain empty strings as values?

Thanks Sujan 12. I now entered the same info as in Taxoil-Info.plist into config.xml and package.json. It stays there but still disappears from Taxoil-Info.plist.

Please read my previous posts, I really have to know what commands you are executing and how this has to do with Ionic Package to understand this.

As I initially wrote, the problem arises with the build. The command I use is

ionic cordova build ios

As cordova build ios doesn’t remove the info.plis information, I tried

cordova build ios

and found the info.plist stays intact, then I try

ionic package build ios --profile taxoil --release --prod

Now the Taxoil-Info.plist lacks the information about camera, location etc. and after uploading the build via ApplicationLoader, I get an email from iTunes Store saying the build was rejected because no information about camera was included in Info.plist.

This means, as well

ionic cordova build ios

as

ionic package build ios --profile taxoil --release --prod

erases the information about camera, location etc. from Taxoil-Info.plist.

Do the same commands for android also remove the information?
Does ionic cordova prepare also remove the information?
How did you install the plugins?
One more to test: ionic build?

(Right now trying to pin down what or who removes these values and why…)

Android doesn’t have an info.plist.
ionic cordova prepare also removes info.

ionic cordova plugin add cordova-plugin-camera
ionic crodova plugin add cordova-plugin-geolocation

With ionic build the info is removed when cordova prepare runs.

That’s exatly why it would be intereting to know if this messes with the iOS file.

cordova prepare does not I assume?

This is/was missing the variables, that’s why they were empty in these files. The docs pages should have examples of how to add the variable on the installation command (although missing ionic in front of course). Could you try if this fixes that?

Huh, that command runs cordova prepare? Strange…

I’ll try the variables.
My internet connection is very poor.
I’ll write about the result as soon as I can.
Thanks!

1 Like

(As soon as I am on a Mac I will try the commands myself)

1 Like

Thanks a lot Sujan 12! It worked with --variable!

1 Like

Awesome.

Now the question is: Why the heck did it get removed? Can you check if it modified any other files or write somewhere else?

I suppose there was one config file that still contained empty strings for
camera and geolocation, e.g. plugins/ios.json. In each build process, the
-info.plist part in platforms/ios/ios.json is rewritten according to the
plugins/ios.json file and the actual platforms/ios/
-info.plist
thereafter… At least that would explain the phenomenon.

1 Like

Yep. I hate all this duplication in Cordova :confused: Hope that will get cleaned up in the future. Information as this should only be in one place.