I have implemented mobile-first non-secure direct update feature by following this document in IONIC project.
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/application-development/direct-update/
When I push an update using MFP server, It gives a popup in application to download it. It's working fine in Android.
In IOS, After finishing of update, changes are not getting reflected in application. On next adapter call it again shows me update popup and it's going in loop.
Error after finish of update :-
Failed to load webpage with error: The URL can’t be shown
If I kill the application and open again, it's started working with pushed changes.
Mobilefirst plugin works fine with cordova project but with ionic project it gives above error. And plugin cordova-plugin-ionic-webview cause this issue.
MobileFirst server version :- 8.0.0.00-20180220-083852
MobileFirst Cordova(plugin) version :- 8.0.0.00-20180227-121751
iPhone IOS version :-10.3.2
Ionic version :- 3.8.0
Cordova version :- 6.5.0
Permissions in config :-
<access origin="*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
Ionic packs "WKWebview" which on iOS causes direct update not to work. This is a known limitation.
The resolution is to run the following command:
cordova plugin add https://github.com/apache/cordova-plugins.git#master:wkwebview-engine-localhost
More details here.
Update your ionic project with latest Cordova MFP Plugin by running following command.
ionic cordova plugin add cordova-plugin-mfp#latest.
This should resolve the issue which you are facing.
Related
So, I get the error "Failed to load webpage with error: Could not connect to the server" when I try to livereload my app on iOS. I have tried everything I can find on the topic. I've spent all day trying things. So I realized that maybe there is something needed that I don't understand. Here are the things I tried: "ionic cordova prepare iOS", "ionic cordova build iOS", "ionic cordova run ios --address=0.0.0.0 --debug --consolelogs -l", "
<allow-navigation href="http://localhost:8080/*" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
", "cordova plugin rm cordova-plugin-ionic-webview
cordova plugin add cordova-plugin-ionic-webview".
I thought maybe someone might have a different idea, or questions that will lead to the solution.
The app opens, and I get that message as an alert on my splash screen, but then it never moves past the splash screen.
Something I just thought of, if I use "ionic cordova run ios --address=0.0.0.0 --debug --consolelogs -l", do I need to use the ip address of my computer?
Any other suggestions or questions?
The docs will help you here.
Firstly, you will need to run the server.
Do this by running
ionic serve
This should give you something like this at the end:
App running at:
- Local: http://localhost:8100/
- Network: http://192.168.x.xxx:8100/
If you are wanting to run this on an actual iOS device on your network, then you will need to use your servers ip address. eg. 192.168.x.xxx.
Then you should be able to run the cordova livereload like this:
ionic cordova run ios --livereload-url=http://192.168.x.xxx:8100
Hopefully that works for you.
When I’m uploading a build to AppStoreConnect (to test it via
TestFlight for example), I’m getting the well-known deprecation
message:
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).
What I did:
1) Remove ios platform and added V5.1.0 ios platform.
2) Added below in config.xml
3) Ran ionic cordova build ios
List of cordova plugins I’m using:
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-chooser 1.2.6 "Chooser"
cordova-plugin-contacts 3.0.1 "Contacts"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-filepath 1.5.8 "cordova-plugin-filepath"
cordova-plugin-googleplus 5.2.1 "Google SignIn"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-media-capture 3.0.3 "Capture"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-stripe 1.5.3 "cordova-plugin-stripe"
cordova-plugin-telerik-imagepicker 2.3.3 "ImagePicker"
cordova-plugin-video-editor 1.1.3 "VideoEditor"
cordova-plugin-whitelist 1.3.3 "Whitelist"
ionic-plugin-deeplinks 1.0.20 "Ionic Deeplink Plugin"
Ionic Info:
Ionic:
ionic (Ionic CLI) : 4.10.3 (/usr/local/lib/node_modules/ionic) Ionic Framework :
enter code here
ionic-angular 3.9.9 #ionic/app-scripts : 3.2.4
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib#8.1.1)
Cordova
Platforms : ios 5.1.0
Cordova Plugins :
cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview
4.2.1, (and 17 other plugins)
System:
ios-deploy : 1.9.4 ios-sim : 8.0.2
NodeJS : v10.15.1 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS Mojave
Xcode : Xcode 11.3.1 Build version 11C504
Does anybody have an idea what could cause the issue?
Thank you so much in advance!
As they said in Understanding ITMS-90809: UIWebView API Deprecation:
Add cordova plugin add cordova-plugin-ionic-webview#latest
Check all of your plugins. Update used (for example InAppBrowser 3.2.0) or remove unused plugins.
Also, use Cordova iOS 5.1.1
The most notable fix in this patch release was to make the prepare
step to wait for the platform add step to finish. This resolved the
bug that was seen when setting the WKWebViewOnly flag before adding
the platform.
ionic cordova platform remove ios
ionic cordova platform add ios#5.1.1
In config.xml add:
<platform name="ios">
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
</platform>
More about this you can find in the article How To Use 'WKWebViewOnly'.
The above example uses the cordova-plugin-wkwebview-engine plugin:
Add plugin cordova-plugin-wkwebview-engine, preferably the latest version 1.2.1
Add preference attribute CordovaWebViewEngine to the config.xml
Add feature attribute CDVWKWebViewEngine to the config.xml
Add preference WKWebViewOnly to the config.xml
And last but not least:
ionic cordova prepare ios
I hope this helps. I've followed these steps and didn't have any problems with an update to the App Store.
Check the CordovaLib target -> Build Stettings -> User Defined (very bottom) of your project. There you find WK_WEB_VIEW_ONLY = 0 set this to WK_WEB_VIEW_ONLY = 1 Setting the macro via GCC_PREPROCESSOR_DEFINITIONS does not work. You can also search for WK_WEB_VIEW_ONLY with Xcode and it will display quickly if the Flag is set to 0.
This flag will be changed by Cordova only if the configure.xml contains <preference name="WKWebViewOnly" value="true" /> at the time you create a new ios project. So changing it manually in XCode to 1 in addition to adding the preference makes sense.
With latest update apple removed UIWebView usage so app submitted with this UIWebView will be rejected, they want app to be build using WKWebView for improved security and reliability.
NOTE : If you some how added this plugin "cordova-plugin-wkwebview-engine" and ran "npm i cordova-plugin-wkwebview-engine" kindly undo these steps i.e (Remove plugin and npm uninstall it). As this will fail the build ios step with error 65.
To achieve this in our existing project we need to follow these steps in sequence so that our app gets deployed in App Store.
1). ionic cordova platform remove ios
2). ionic cordova plugin remove cordova-plugin-ionic-webview
3). ionic cordova plugin add cordova-plugin-ionic-webview#latest
4). npm install #ionic-native/ionic-webview#latest
5). Add following XML code in config.xml file under platform ios
// These preferences and feature will automatically replace UIWebView to WKWebView in all the places of code during compile time.
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
6). Check in package.json file under dependencies key "cordova-ios": "5.1.1" should exist, if not exist then add "cordova-ios": "5.1.1"
7). ionic cordova platform add ios
8). ionic cordova prepare ios
9). ionic cordova build ios
Now these steps will successfully build the ios App and will be ready for deployment.
NOTE: I tested these steps in ionic 3 and ionic 4.
Hope this will help you or somebody else!
Thanks!
I am having problems running the cordova project in the ios emulator. The console.log file does not exist. On Android it is working though. I think it is because of the version of my cordova ios platform, cause when I do:
cordova plugin add cordova-plugin-console
it says:
Plugin doesn't support this project's cordova-ios version. cordova-ios: 4.5.2, failed version requirement: <4.5.0
So my version is too high and does not meet the requirement. What should I do? Should I downgrade it, if yes how can I do that?
Since cordova-ios 4.5.0 cordova-plugin-console is included in the cordova-ios base, you do not need this plugin anymore. You can read about it here.
Check if there is this feature element in the config.xml:
<feature name="Console">
<param name="ios-package" value="CDVLogger"/>
<param name="onload" value="true"/>
</feature>
If not you have to add it as a child of the ios platform tag to use console.log() and other console functions. You can comment it out for production builds.
Currently, I'm working on an app. For the notifications I've been using phonegap-plugin-push combined with Firebase.
I'm using this plugin for Android as well as iOS. On Android it works perfectly fine, sure I've been experiencing problems, but got it all done now. IOS on the other hand won't work. The app won't even build.
If I build I get this error:
** BUILD FAILED**
The following build commands failed:
CopyPlistFile
/Users/gio/app/Project/platforms/ios/build/emulator/Project.app/GoogleService-Info.plist
/Users/gio/App/App/Project/platforms/ios/Project/Resources/GoogleService-Info.plist
(1 failure)
Error: Error code 65 for command: xcodebuild with args:
-xcconfig,/Users/gio/app/Project/platforms/ios/cordova/build-debug.xcconfig,-workspace,Project.xcworkspace,-scheme,Project,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS
Simulator, name = iPhone
SE,build,CONFIGURATION_BUILD_DIR=/Users/gio/app/Project/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/gio/app/Project/platforms/ios/build/sharedpch
As you can notice the path that the app is searching for has a double "root" (/App/App/)
I guess that the programming is trying to put of get something to of from a path that doesn't exist.
The strange thing is that it works on Android without any problems and it won't work on iOS.
Cordova version: 7.0.1
Cordova iOS version: 4.4.0
Make sure that you have this in your config.xml:
<platform name="ios">
<resource-file src="GoogleService-Info.plist" />
</platform>
And that your GoogleService-Info.plist file is at the root of your app via documentation.
If this doesn't work for you, I would suggest trying cordova-plugin-fcm instead. I have used both and find cordova-plugin-fcm to work best.
im new to ionic and angular js. I was building my app succesfully using the ionic cli, now I am having an issue while building for ios which was working fine since yesterday. I have updated ionic, create new project but still cannot run this command "ionic build ios", however "ionic serve" works successfully. Please note that I am using a mac and these command were working fine before. Grateful if someone can help me. Thanks.
For people who are having this issue, it looks like it's a bug in Node 5.7.0, to be fixed in 5.7.1:
https://github.com/driftyco/ionic-cli/issues/815
https://issues.apache.org/jira/browse/CB-10675
https://github.com/nodejs/node/issues/5393
Downgrading your Node version or updating when 5.7.1 comes out should resolve the issue.
Ok, just ran into the same issue, while building on iOS (Android worked fine). It seems that it has got to do with config.xml .
I had to put <access origin="mailto: ... launch-external="true"/> under <platform name="android"> and the issue was solved.
Hope that helps.
To solve this problem just move all <access origin="file:..." or <allow-navigation href="file:.." /> under <platform name="android"> in your config.xml