App stuck in white screen in iOS ionic 5 app - ios

I pushed newly created ionic app to test flight and got bellow error.
ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview).
Follow the below steps to Fix it.
1) Created new ionic app (Ionic version 5.0.0)
2) Added iOS platform (ionic cordova platfrom add ios#5.1.1)
3) After adding platform below plugins will get added to package.json & config.xml
Package.json :
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-ionic-webview": "^4.1.1",
Config.xml
<plugin name="cordova-plugin-whitelist" spec="1.3.3" />
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.0.1">
4) Removed Webview plugin as suggested ionic Cordova plugin rm cordova-plugin-ionic-webview.
5) Removed platform ionic cordova platform rm ios
6) Added plugin cordova-plugin-wkwebview-engine#1.2.1 --save
7) Added preference attribute CordovaWebViewEngine to the config.xml as below.
8) Added feature attribute CDVWKWebViewEngine to the config.xml as below.
9) Added preference WKWebViewOnly to the config.xml as below.
"<platform name="ios">
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
</platform>"
10) Added ios platform "ionic cordova platform add ios#5.1.1 --save"
11) Build project "ionic cordova build iOS"
12) Open project in XCode and try to launch app in Simulator and iPhone getting white screen after splash screen
Now app got stuck in white screen after splash screen, Please help me to resolve this issue.
Thanks
Anshul

Related

App Store Connect ITMS-90809 error: Native iOS app developed with Cordova using CocoaPods

We are developing a native iOS app using Cordova and its plugins. We installed Cordova using CocoaPods.
The app is working fine in the simulators and real devices. But when we are uploading it to App Store Connect we are getting the following error:
ITMS-90809: Deprecated API Usage – Apple will stop accepting submissions of apps that use UIWebView APIs.
For the above issue we installed cordova-plugin-wkwebview-engine with CocoaPods. It is working fine in simulators but giving the same error during the upload.
So kindly help us to resolve this issue as soon as possible.
Have you tried to add the following in your config.xml in the iOS platform element?
<platform name="ios">
<preference name="WKWebViewOnly" value="true" />
</platform>
Add the following in config.xml under <platform name="ios">
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
And make sure you're using Cordova iOS 5.1.1 or later

Cordova inappbrowser not working when build in xcode

Since 30th of april Apple does not allow apps build with SDK lower than 13. Ive used to build my apps using Phonegap build (https://build.phonegap.com/) but it uses SDK 12. Now im trying to build my apps using Xcode.
Every build i do using Phonegap build and using a test distribution profile to install this build on my phone works like a charm but when i build the app using the same config.xml as i use for my Phonegap build the inappbrowser is not working anymore.
I think it has something to do with the UIWebView being depricated as of SKD 13. Therefor ive used the tutorials provided by Cordova to implement the WkWebview.
I've tried removing all plugins except wkwebview-engine and inappbrowser but this has no effect.
Cordova CLI 9.0.0
inappbrowser 3.2.0
wkwebview-engine 1.2.1
ios platform add 5.1.1
My config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.app.name" version="0.2.13" xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>appname</name>
<description>
</description>
<author email="mymail" href="mywebsite">
my name
</author>
<content src="dist/index.html"/>
<platform name="ios"/>
<platform name="android"/>
<feature name="http://api.phonegap.com/1.0/network"/>
<preference name="permissions" value="none"/>
<preference name="phonegap-version" value="cli-9.0.0"/>
<preference name="orientation" value="portrait"/>
<preference name="target-device" value="universal"/>
<preference name="prerendered-icon" value="true"/>
<preference name="detect-data-types" value="false"/>
<preference name="exit-on-suspend" value="false"/>
<preference name="deployment-target" value="7.0"/>
<preference name="webviewbounce" value="false"/>
<preference name="stay-in-webview" value="false"/>
<preference name="ios-statusbarstyle" value="black-opaque"/>
<preference name="ShowSplashScreenSpinner" value="true"/>
<preference name="AutoHideSplashScreen" value="true"/>
<preference name="android-minSdkVersion" value="19"/>
<preference name="android-targetSdkVersion" value="28"/>
<preference name="android-installLocation" value="auto"/>
<preference name="android-windowSoftInputMode" value="stateVisible|adjustResize"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="ShowSplashScreen" value="true"/>
<preference name="FadeSplashScreen" value="false"/>
<preference name="SplashScreenDelay" value="2000"/>
<preference name="FadeSplashScreenDuration" value="0"/>
<platform name="android">
<preference name="fullscreen" value="false"/>
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:usesCleartextTraffic="true"/>
</edit-config>
</platform>
<platform name="ios">
<preference name="fullscreen" value="false"/>
</platform>
<access origin="*"/>
<allow-navigation href="*"/>
<allow-navigation href="*://*youtube.com"/>
<access origin="mailto:*" launch-external="true"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<allow-intent href="tel:*"/>
<allow-intent href="sms:*"/>
<allow-intent href="mailto:*" launch-external="yes"/>
<allow-intent href="geo:*"/>
<platform name="android">
<allow-intent href="market:*"/>
</platform>
<platform name="ios">
<allow-intent href="itms:*"/>
<allow-intent href="itms-apps:*"/>
<allow-navigation href="mailto:*" launch-external="yes"/>
</platform>
<feature name="TouchID">
<param name="ios-package" value="TouchID"/>
</feature>
<platform name="ios">
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
</platform>
<plugin name="cordova-plugin-inappbrowser" spec="3.2.0" />
<plugin name="cordova-plugin-wkwebview-engine" spec="1.2.1" />
</widget>
before testing i do this to make sure all plugins are installed fresh:
rm -rf package-lock.json package.json platforms plugins/* node_modules
cordova platform add ios#5.1.1
i receive no response in the xcode console just this information when build is finished:
2020-05-13 16:23:33.805959+0200 App[7410:670156] [Accessibility] ****************** Loading GAX Client Bundle ****************
2020-05-13 16:23:33.996820+0200 App[7410:670156] Apache Cordova native platform version 5.1.1 is starting.
2020-05-13 16:23:33.998789+0200 App[7410:670156] Multi-tasking -> Device: YES, App: YES
2020-05-13 16:23:34.016143+0200 App[7410:670156]
Started backup to iCloud! Please be careful.
Your application might be rejected by Apple if you store too much data.
For more information please read "iOS Data Storage Guidelines" at:
https://developer.apple.com/icloud/documentation/data-storage/
To disable web storage backup to iCloud, set the BackupWebStorage preference to "local" in the Cordova config.xml file
2020-05-13 16:23:34.282716+0200 App[7410:670156] CDVWKWebViewEngine will reload WKWebView if required on resume
2020-05-13 16:23:34.283306+0200 App[7410:670156] Using WKWebView
2020-05-13 16:23:34.284438+0200 App[7410:670156] [CDVTimer][console] 0.174999ms
2020-05-13 16:23:34.285355+0200 App[7410:670156] [CDVTimer][handleopenurl] 0.338078ms
2020-05-13 16:23:34.290426+0200 App[7410:670156] Unlimited access to network resources
2020-05-13 16:23:34.291285+0200 App[7410:670156] [CDVTimer][intentandnavigationfilter] 5.457997ms
2020-05-13 16:23:34.292067+0200 App[7410:670156] [CDVTimer][gesturehandler] 0.302076ms
2020-05-13 16:23:34.292696+0200 App[7410:670156] [CDVTimer][TotalPluginStartup] 8.646965ms
I'm out of ideas to fix this. maybe anyone has some fresh look so i can try some new things.
Well managed to find the answer. My file structure was www/dist/index.html and in there was the link to cordova.js
<script type="text/javascript" src="cordova.js"></script>
it needed to be:
<script type="text/javascript" src="../cordova.js"></script>
besides that, during the command:
cordova platform add ios#5.1.1
there were some yellow messages for example:
Failed to install 'cordova-plugin-inappbrowser': Error: Cannot find module 'glob'
I was ignoring them because well... yellow
after some research i came across the solution for this. after the messages execute:
cordova platform rm ios
And then again:
cordova platform add ios#5.1.1
the second time the plugins are installed successfully and this time the inappbrowser works again.
for now this is a workaraound, the question im still having is why i get the Failed to install 'cordova-plugin-inappbrowser': Error: Cannot find module 'glob'messages when adding the platform for the first time..?

ionic cordova run ios - Export failed with code 65

I'm done with research on this error. I get following error when trying to run ionic cordova run ios --livereload:
[cordova] Non-system Ruby in use. This may cause packaging to fail.
[cordova] If you use RVM, please run `rvm use system`.
[cordova] If you use chruby, please run `chruby system`.
[cordova] error: archive not found at path '/Users/yassinezeriouh/Desktop/doday2/platforms/ios/DoDay.xcarchive'
[cordova] ** EXPORT FAILED **
[cordova]
[cordova] CordovaError: Promise rejected with non-error: 'Error code 65 for command: xcodebuild with args: -exportArchive,-archivePath,DoDay.xcarchive,-exportOptionsPlist,/Users/yassinezeriouh/Desktop/doday2/platforms/ios/exportOptions.plist,-exportPath,/Users/yassinezeriouh/Desktop/doday2/platforms/ios/build/device,-allowProvisioningUpdates'
re-installed ios
downgraded ios
all signing is correct in xcode
tried with custom build.json
re-installed all plugins
Running the project in xcode on my device works perfectly, tried to fix this issue since 4 hours, hope you can help.
I'm running iOS 12, using Xcode 10.1, cordova 8.1.2, ionic 4.40 (project is actually running on ionic v3 and was created last month)
My config.xml (except android & ios splash/icon section):
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.zeriouh.censored" version="1.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Censored</name>
<description>Censored</description>
<author email="cen#so.red" href="http://ce.nsor.ed/">Yassine Zeriouh</author>
<content src="index.html" />
<access origin="*" />
<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="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="19" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="false" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="100" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<engine name="android" spec="6.3.0" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
<plugin name="cordova-plugin-device" spec="^2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^2.2.0">
<variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
</plugin>
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.1.3" />
<plugin name="cordova-plugin-inapppurchase" spec="~1.2.0" />
<plugin name="com.omarben.inappreview" spec="~0.0.6" />
<plugin name="cordova-plugin-admob-free" spec="~0.22.0" />
<plugin name="cordova-plugin-email-composer" spec="~0.8.15" />
<plugin name="cordova-plugin-local-notification" spec="~0.9.0-beta.2" />
<plugin name="cordova-plugin-badge" spec="~0.8.7" />
<plugin name="cordova-plugin-apprate" spec="~1.4.0" />
<engine name="ios" spec="~4.5.5" />
</widget>
try this beacuse the xcode 10.1 build in a diferent way to the ionic 3 now
ionic cordova run ios -- --buildFlag="-UseModernBuildSystem=0" --livereload
There is an issue with "cordova-ios": "4.5.5".
Try following below steps.
ionic cordova platform rm ios
npm uninstall cordova-ios
npm install cordova-ios#4.4.0
ionic cordova platform add ios#4.4.0
ionic cordova run ios --livereload
For me it worked after changing my cordova-ios version from 4.5.5 to 4.4.0.
in package.json I changed "cordova-ios": "4.5.5" to "cordova-ios": "4.4.0"
in config.xml I changed <engine name="ios" spec="4.5.5" /> to <engine name="ios" spec="4.4.0" />
rm -rf node_modules/ platforms/ios/
npm i
ionic cordova build ios
I have the same problem when I'm building for ios with "prod" tag.
I have:
MacOS catalina 10.5.4
Xcode version 12.2
cordova-ios 6.0.0
For me the solution that worked was first sign the app on xcode after the first build issue (open platform/ios with xcode and sign the app). Then I build with the commands that people suggest here, but I have to add the "--device" tag also. After that work good :)
ionic cordova run ios --prod --release --buildFlag="-UseModernBuildSystem=0" --device

iOS10 cordova-camera-roll crashes app

Newest iOS 10.2, Phonegap build crashes with cordova-camera-roll version 0.2.1 plugin.
Using Phonegap version cli-6.3.0
<preference name="phonegap-version" value="cli-6.3.0" />
Looks like the new plugin cordova-plugin-ios-camera-permissions and cordova-plugin-ios-microphone-permissions solves the issue.
<plugin name="cordova-plugin-ios-camera-permissions" spec="1.0.3" />
https://www.npmjs.com/package/cordova-plugin-ios-camera-permissions
<plugin name="cordova-plugin-ios-microphone-permissions" spec="1.0.0" />
https://github.com/pinchnzoom/cordova-plugin-ios-microphone-permissions

Cordova iOS Cross origin requests are only supported for HTTP

I'm building an iOS app and recently upgraded cordova-ios to 4.1.0 and started using: cordova-plugin-wkwebview-engine.
The problem is that now I get the error message Cross origin requests are only supported for HTTP while trying to load dependencies, so the app won't start.
It's trying to load systemjs dependencies over file://, but I included in my config.js.
I have no clue how to fix this. Does anyone have experience with this bevaviour?
cordova version: 6.1,0
cordova ios version: 4.1.0
related config.xml bit:
<access origin="*" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
Install this one plugin (cordova-ios 6+)
cordova plugin add https://github.com/globules-io/cordova-plugin-ios-xhr
then set
<preference name="AllowUntrustedCerts" value="true" />
<preference name="InterceptRemoteRequests" value="all" />
<preference name="allowFileAccessFromFileURLs" value="true" />
<preference name="allowUniversalAccessFromFileURLs" value="true" />
Install the following plugins:
cordova plugin add cordova-plugin-wkwebview-engine
cordova plugin add cordova-plugin-wkwebview-file-xhr
cordova plugin add https://github.com/TheMattRay/cordova-plugin-wkwebviewxhrfix
Add to config.xml:
<platform name="ios">
...
<preference name="WKWebViewOnly" value="true"/>
...
</platform>
For Cordova iOS 6+ just need to install the following plugin.
cordova plugin add https://github.com/AraHovakimyan/cordova-plugin-wkwebviewxhrfix
This plugin does not depend on any other additional plugins and does not require additional permissions.
I had the same issue with my cordova project (actually Ionic v1) and I fix it with the following command:
cordova plugin add https://github.com/apache/cordova-plugins.git#wkwebview-engine-localhost
This will install a webserver that runs locally and the error should be gone after that. After you run that command, just run:
cordova prepare ios
or remove all plugins and reinstall:
rm -rf plugins/
cordova platform add ios
Make sure you have this in your config.xml:
<access origin="*" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
If you work with cordova-ios ^6.0.0. you need only to modify your config.xml file:
<platform name="ios">
...
<preference name="scheme" value="app" />
<preference name="hostname" value="localhost" />
...
</platform>
No need to install any additional plugins.
See Cordova iOS 6.0.0 Released for more info.
I had the same issue with my ionic v1 Cordova project. For me the solution was to migrate to capacitor, like this:
Start a New Ionic v1 project (% ionic start Bienchen blank --type ionic1)
Answer "yes" when the cli asked if to integrate "capacitor".
Checkout my Sources to the www-folder of the new Ionic v1 project
Build the project with capacitor (% ionic capacitor build iOS)
Keep in mind the the Cordova config.xml than is not longer used, instead configure in Xcode Project.

Resources