How to remove Phonegap Build Permission alert in iOS? - ios

I'm using Phonegap Build to compile a game I made using Construct 2.
Now when I install the game on my iphone a geolocation permission alerts pops up, although my game doesn't use geolocation.
I think phonegap somehow inserts geolocation code into the .ipa file
I thought this wasn't gonna be a problem, but I submitted the game to the appstore and the reviewer is asking me what features of my game use geolocation. My game status in itunes connect right now is 'metadata rejected' because of this.
Is there a way to remove this geolocation thing?
I already googled the problem but I can't find a solution.
Here's my config.xml file:
> <preference name="permissions" value="none"/> <preference
> name="android-targetSdkVersion" value="21" /> <feature
> name="http://api.phonegap.com/1.0/network"/> <gap:config-file
> platform="ios" parent="UIStatusBarHidden"><true/></gap:config-file>
> <gap:config-file platform="ios"
> parent="UIViewControllerBasedStatusBarAppearance"><false/></gap:config-file> </widget>

#gleegum, when you install the plugin via config.xml, it will initiate the Geolocation permission sequence. Did you perhaps accidentally insert the geolocation plugin into your config.xml? -Jesse

Related

Ionic app does not remove local data after uninstalling

I have found a solution for Android but not able to get one for iOS.
I logged into my app
Perform some tasks that save data in local storage
Go to Home and uninstall the app
Install App again
All previously stored data reappear
It should remove all data upon uninstallation.
If you are using Cordova, add the following in your config.xml-
For iOS
Inside <platform name="ios">-
<preference name="BackupWebStorage" value="none" />
Default value is cloud. https://cordova.apache.org/docs/en/latest/config_ref/index.html
For Android
Inside <platform name="android">-
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:allowBackup="false" android:fullBackupContent="false" />
</edit-config>

Cordova iOS no longer loading three.js .glb files

I have a Cordova app (built with react) which renders 3d (.glb) models on my iPhone (using three.js).
It's old, and used Cordova's iOS#5 platform. I updated it to Cordova's newer ios#6 platform, and the .glb files no longer load on the iPhone.
They load fine locally, when run in the browser. but they do not load in the iPhone. If I use the older ios 5, it works fine.
Is there a known reason three.js no longer works in ios6? a plugin that needs to be added? a build setting that must now be added that didn't before?
It's most probably because you were running UIWebView which has been deprecated. Now WKVebView does not allow to load files like UIWebView used to.
You could give a try to this plugin https://github.com/globules-io/cordova-plugin-ios-xhr and then set your preferences to
<preference name="AllowUntrustedCerts" value="true" />
<preference name="InterceptRemoteRequests" value="all" />
<preference name="allowFileAccessFromFileURLs" value="true" />
<preference name="allowUniversalAccessFromFileURLs" value="true" />
Note that this is for iOS 6+

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..
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
I'm using phonegap plugin org.apache.cordova.camera and solution which 100% works is here :
All you have to do is put values in config.xml file and build with phonegap.
My config.xml :
<plugin name="org.apache.cordova.camera">
<variable name="CAMERA_USAGE_DESCRIPTION" value="App would like to access the camera." />
<variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="App would like to access the library." />
</plugin>
You'll have to add the NSPhotoLibraryUsageDescription and NSCameraUsageDescription into your *.plist in your xcode;
NSPhotoLibraryUsageDescription = Privacy - Photo Library Usage Description
NSCameraUsageDescription = Privacy - Camera Usage Description
Then into the value just add a description for those privacy settings.
Hope it helps
You must add the key NSPhotoLibraryUsageDescription into Info.plist (in Xcode), and the value must be the reason for the user to allow camera usage (appears in the request camera confirm dialog)
Found the solution: $ cordova plugin list and re-install all plugins and read their docs of how to install them regarding the NSPhotoLibraryUsageDescription etc .
Add the below in your config.xml file and it'll work fine.
<gap:plugin name="cordova-plugin-media-capture" source="npm">
<param name="CAMERA_USAGE_DESCRIPTION" value="We'd like to access your camera to let you take a photo"/>
<param name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="We'd like to access your photo library to let you pick a photo"/>
<param name="MICROPHONE_USAGE_DESCRIPTION" value="We'd like to access your microphone to let you record an audio"/>
</gap:plugin>
Here is the complete config.xml file for PhoneGap Build.
https://github.com/moodlehq/moodlemobile-phonegapbuild/blob/master/config.xml

cordova - How to disable orientation upside down for ios?

In my app(ionic + cordova) i set orientation for portrait, but when i open xcode to build, the option updside down is enable. how can i disable upside down in my config.xml?
my config.xml
<preference name="orientation" value="portrait" />
thank you
So it's a combination of the config.xml file and XCODE settings.
In the config.xml file you'll need to add the following line right before the closing </widget> tag
<preference name="Orientation" value="default" />
Then inside of Xcode need to disable the Upside Down option under the Device Orientation settings.
Then you will have to delete the platforms directory then rebuild the apps so that the change will take.
Try changing your config.xml to: <preference name="orientation" value="default" />
Then at the platform level for iOS change your preference value to "portrait" via: <preference name="orientation" value="default" />
Config Ref
Default: default
Allowed values:
default, landscape, portrait.
This allows you to lock orientation and prevent the interface from rotating in response to changes in orientation.
NOTE: The default value means Cordova will strip the orientation preference entry from the platform's manifest/configuration file allowing the platform to fallback to its default behavior. For iOS, to specify both portrait & landscape mode you would use the platform specific value 'all'.
I had the opposite problem then solved it by changing this. I hope this helps!
You can't untick iOS "up-side-down" by config file.
But you can use screen-orientation plugin to control it.
(website)
I found a solution that is working for my projects.
With the installed Cordova plugin cordova-custom-config you can overwrite the UISupportedInterfaceOrientations-Setting with the following code inside of the <platform name="ios">:
<custom-config-file mode="replace" parent="UISupportedInterfaceOrientations" platform="ios" target="*-Info.plist">
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
</custom-config-file>
Important is the parameter mode="replace"
The Key is of type Array and will be merged by default.
Outside the platform-tags you can set the default <preference name="orientation" value="portrait" />. This will be used for Android and woont allow upside down there.
The only and better way to do that is, simply install cordova-plugin-screen-orientation plugin in your project.
And in the ionic.Platform.ready(function() {}) use the following code:
if (window.cordova && cordova.plugins) {
cordova.plugins.screenorientation.setOrientation('portrait-primary');
}
I also had the same issue, which was causing iPhone SE to change orientation upside-down, and this code fixed it for me.

plugin plugin.google.maps using phonegap build service doesnt work on ios

i have a small project using the plugin plugin.google.maps (https://github.com/wf9a5m75/phonegap-googlemaps-plugin) .
Also, i use phonegap buid service, not CLI.
In config.xml file i have the code
<gap:plugin name="plugin.google.maps" source="plugins.cordova.io" version="~1.2.4">
<param name="API_KEY_FOR_ANDROID" value="xxx" />
<param name="API_KEY_FOR_IOS" value="xxx" />
</gap:plugin>
Android apk's works like a charm, but on ios device i get the message
"Api key is not setted.
Please replace 'API_KEY_FOR_IOS' in the platforms/ios/.../...Info.plist with your API key."
Does anyone have a clue how i can solve this using the phonegap build service?
Despite the fact that this was supposed to work
(https://github.com/wf9a5m75/phonegap-googlemaps-plugin/issues/411#issuecomment-75452290)
after a couple of days in a nutshell i figured that i had to override the instructions for ios property list for the plist key "Google Maps API Key".
So, in config.xml i inserted the code:
<gap:config-file platform="ios" parent="Google Maps API Key" mode="replace">
<string>xxx</string>
</gap:config-file>
where xxx is the Google Maps API Key for iOS
http://docs.build.phonegap.com/en_US/configuring_config_file_element.md.html

Resources