I have made an app for ios and installed in my iphone. It has Camera plugin in it. It works perfect in android.
Also in iphone, as I run ionic view app (downloaded from appstore) it works perfect into that (first my phone asks about allowing access to camera), But not working in my own app.
NOTE: I installed .ipa from diawi.com
In ionic view app :
But in my own app, Nothing! Doesn't work. Even auto rotation just works in ionic view app.
Any idea?
Finally I found the solution:
Just add --save after installing a plugin. For example:
cordova plugin add cordova-plugin-camera --save
As in ionic package docs says:
Cordova plugins may be installed locally, they may not be defined explicitly in your config.xml. To ensure that the build servers know about which plugins you need, use the --save flag when adding and removing plugins.
Also pay attention to this.
Related
I've managed to follow all the steps in the block materials up to installing Cordova but hit some problems when trying to add android. The error says that Cordova failed to fetch cordova-android#^9.1.0. Attached is the screen grab showing the list of errors:
Screenshot of Android installation error in Cordova
I have tried uninstalling and reinstalling all components including Cordova right from the very first step multiple times but I still cannot get it to work. I have also already checked that I am not going through a proxy server.
I tried adding android to Cordova using the command:
cordova platform add android
It should have added the Android platform for development in Cordova.
I'm building an iOS application using Xcode/Swift, and I have a few less-than-technical group members who don't really know how to build Xcode projects, but are interested in seeing/testing the progress of the application. One group member pointed out that they could test the app using Ionic/Ionic View. However, to my understanding, Ionic works by building an application in the specific Ionic framework, and then Ionic translates the project into an Xcode/Swift project (.xcodeproj) or an Android project. Is there a way to do the reverse conversion––is there a way to convert my Xcode project so that it will work on Ionic, or specifically Ionic View?
Ionic is tool like cordova created to develop hybrid apps (from HTML+JS+CSS --> to Native iOS/Android/WinPhone/BlackBerry). The UI is running in native webView, and using some native functionalities by plugins but it is not created to make Ionic/Cordova app from native.
If you want to share your app to tests, use Apple TestFlight
'Ionic View' is a very good advice and the one I would suggest in your case as well.
You don't have to do anything in your code really to use it, just create an ionic account and in your terminal, change into your ionic project directory and then type:
$> ionic upload
You will be asked for the usernmame and password of the account you just created, the application will be uploaded and you will get a unique app ID. You can then share that ID with anyone who you want to test your app, as long as they have the Ionic View app installed on the their iOS or Android devices.
Also do make sure you have updated your global ionic and cordova packages to the latest version before you upload:
$> sudo npm uninstall -g ionic && sudo npm install ionic
Now, as 3squad mentioned, many of they Ionic Native plugins are not supported so don't expect everything to work, but it's a good start to show most of your app and design running.
Here's a list of currently supported plugins.
Please do keep in mind that the performance using Ionic View will be far worse than if you actually build, release and give your users and actual production .apk or .ipa file to install. This latter approach would also showcase the full, final performance and functionality resulting from your code, but it may be more cumbersome.
Here's how to release a production version of your app.
I have inherited a Cordova project that mixes web code with native code.
I'm using cordova CLI 6.3.1 and the cordova ios platform version is 3.9.2.
Whilst working I come across this warning in the console.
Using this version of Cordova with older version of cordova-ios is
being deprecated. Consider upgrading to cordova-ios#4.0.0 or newer.
However, when I try updating the ios platform version using cordova platform update ios --save it completely wipes out all files in the "platforms" folder - which currently includes all the custom iOS project files, i.e. custom classes and what not.
Is there something fundamentally wrong with our project setup?
What is the recommended way to mix and match cordova web and native iOS code so that updating the cordova ios platform doesn't nuke everything?
Generally, the files under /platforms are generated on the fly based on changes that are made in /www. Running cordova prepare ios, cordova build ios, cordova platform update ios, or cordova run ios, will always nuke the platforms/ios folder and retreat it based on /www.
You mentioned your project has custom native code. Is that native code built as a cordova plugin? If so then you should be good following the standard workflow. Work in /www. Test your project cordova run ios.
If not, you might want to consider refactoring the native code you have as a plugin.
Look at this plugin's code structure as an example.
Follow this guide on how to start developing a plugin.
My Ionic app was working absolutely fine until I got a message to upgrade Cordova from 6.0.0 to 6.1.0 after running cordova prepare to compile in xcode.
I then received a message to update to cordova-ios#4.0.0 or higher, which I also did.
This is when the trouble started. My app lost resources and I had to start updating plugins too. Did some searching and removed the platform and re-added.
Latest problem, which I can't seem to google is there is now a spinner that won't go away, and won't let me interact with the app. See screenshot below. I've remove all reference to $ionicLoading, even though the loader does not look like this.
Please, any help on where I can start debugging this would be greatly appreciated!
Mysterious loader that won't remove
Ended up being a problem with Ionic Keyboard. Steps to get it fixed for me was to:
cordova platform rm ios
cordova platform add ios
cordova plugin rm ionic-plugin-keyboard
cordova plugin add ionic-plugin-keyboard
Removed this code from js:
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
Then ran cordova prepare
according to OneSignal's site just add this code to ask the user to allow the app to receive push notification :
window.plugins.OneSignal.registerForPushNotifications();
but it doesn't show up. And the device cannot register.
document.addEventListener("deviceready", function() {
window.plugins.OneSignal.init( "project_id",
{googleProjectNumber: "null_if_ios",
autoRegister: false},
mobile.didReceiveRemoteNotificationCallBack);
For Android, this works just fine. No need to call the registerForNotifications function.
The above code is for a much older version of the OneSignal Cordova SDK, make sure to use the latest version: https://documentation.onesignal.com/docs/cordova-sdk-setup
For Cordova and Cordova variants, many issues can be fixed by checking:
Your OneSignal appID does not have any extra spaces between the quotes.
You are using Cordova 6.4.0 or newer
If using CocoaPods, make sure you have version 1.2.0 or newer installed: https://documentation.onesignal.com/docs/cordova-sdk-setup#section-ios-requirements
You must test on an actual device, not the browser.
Update to the latest version of the OneSignal SDK, run:
cordova plugin rm onesignal-cordova-plugin
cordova plugin add onesignal-cordova-plugin
Many users simply need to make a clean build to remove the errors. Please see the Cordova Variants Troubleshooting guide: https://documentation.onesignal.com/docs/troubleshooting-cordova-variants
Finally, checkout the Github example to compare code:
Cordova Example: https://github.com/OneSignal/OneSignal-Cordova-Example
Ionic Example: https://github.com/OneSignal/OneSignal-Ionic-Example