Cordova iOS no longer loading three.js .glb files - ios

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+

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 - 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.

Odd padding in iPad Cordova app

Can anyone explain this odd padding that exists outside the entire webview?
Our app has been denied by Apple because of this issue.
I have Googled it for days with no success.
Try setting this in your config.xml:
<platform name="ios">
<preference name="target-device" value="universal" />
</platform>
Universal is the default value, so make sure you are not setting target-device to something else ;)

How to remove Phonegap Build Permission alert in 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

Is there any possibility to disable the screen rotation of the app in jquery-mobile

Hey guys i'm using phonegap and jquery mobile to build an app for an android phone. Is there any possibility to disable the screen rotation of the app. I am very new to jquery mobile. Sorry if I am asking inappropriate question.
Yes it's possible but you must set it in cordova/phonegap parameter not in your app/www
in your app folder there is config.xml
<preference name="orientation" value="default" />
<!-- all: default means both landscape and portrait are enabled -->
Do you want to do it only using Jquery? Can you think of using Android's Manifest file to fix an orientation for the activity?
Change the following attributes in manifest file:
android:screenOrientation="portrait" or android:screenOrientation="landscape" in the AndroidManifest.xml:
<activity android:name=".MyActivity"a
android:label="#string/app_name"
android:screenOrientation="portrait">
Include the following code in your 'config.xml'
<preference name="Orientation" value="landscape" />
or
<preference name="Orientation" value="portrait" />

Resources