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.
Related
I update my Cordova ios to version 6 because of apple email that says ( Deprecated API Usage - existing app that use UIWebView are no longer accepted) ,but after that i keep getting this build error,
The following build commands failed:
CompileC /Users/moesaif/Library/Developer/Xcode/DerivedData/مفسر_أحلامي-epzhtxsuxnuafngaxollgqmkcrww/Build/Intermediates.noindex/مفسر\ أحلامي.build/Debug-iphonesimulator/مفسر\ أحلامي.build/Objects-normal/x86_64/CDVFileTransfer.o /Users/moesaif/Desktop/Dreams/platforms/ios/مفسر\ أحلامي/Plugins/cordova-plugin-file-transfer/CDVFileTransfer.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
ionic Cordova platform ls :
Installed platforms:
android 7.1.4
browser 6.0.0
ios 6.1.1
Available platforms:
electron ^1.0.0
osx ^5.0.0
windows ^7.0.0
any help please..!
Thanks.
You need to update the plugin to latest version. If it still uses UIWebView, then you need to update it manually to support WKWebView.
cordova-plugin-file-transfer is deprecated and seems not working with the ios#6.1.1 .
I still use it with ios#5.1.1 and the flag in config.xml to use WKWebview:
<preference name="WKWebViewOnly" value="true" />
Before sending to apple, search and check in Xcode, that you don't have any mention to UIWebview.
Sometimes a clean platforms is needed or you still have and old InAppBrowser version
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 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.
I tried setting the line:
<preference name="Orientation" value="landscape" />
in my config.xml file, but it doesn't work (afterwards I tried doing 'cordova build ios' in the command line but still didn't work. Instead what works is going to my project settings in XCode and selecting the orientation there.
But I'm wondering if this is the correct way? shouldn't everything be done in the config.xml file?
I believe that
<preference name="orientation" value="landscape" />
is the correct way. Yet it fails :(
Check PhoneGap Hello World change orientation for a solution I use rather than modify the XCode project.
Have you tried:
$ cordova prepare
Or:
$ cordova platform remove ios
$ cordova platform add ios
How do I update my IOS App with PhoneGap 2.7 to 3.4 when I use an old plugin.
My problem is that I use a PhoneGap plugin "ios-Tabbar plugin" which unfortunately has not been updated for PhoneGap 3 *.
Is it possible to update PhoneGap manual in Xcode, by replacing the packages and classes that belong to PhoneGap, just as you could in the old PhoneGap versions prior to 3.0.
Jacob
Main changes
config.xml structure changed
in 2.7
<plugin name="Echo" value="Echo" onload="true" />
in 3.4
<feature name="Echo">
<param name="ios-package" value="Echo" />
</feature>
and you can use older native code because no changes in the native side check plugin dev docs 3.4 and 2.7 i think this may help you.