I'm creating Ionic 4 Angular app , and using Ionic Native Device plugin but it is not working as expected or shown in their documentation ? any
solution how to use this plugin ?
It is simple thing,we are run app on browser that's why it's give warning message.cordova act as bridge between web app to native app.when app run on any emulator or devices at that time cordova plugin used,when app run on broswer ,then cordova plugin not used
Related
I worked on ionic version 3 app I want to publish it to the apple store I build it successfully but when to submit it to review the app rejected because
We discovered one or more bugs in your app when reviewed on iPad
running iOS 13.7 on Wi-Fi.Your app launches and shows an unresponsive
white screen with no other content.
then I start a new ionic 3 project and I faced the same problem.
I tried to build using Cordova ios v6 and v5 but I have the same problem.
I build it using these commands
ionic cordova platform add ios
ionic cordova run ios --prod -l --external --emulator --consolelogs --target="C62C1D15-1BDF-433C-BD72-2D9957C5F0F7"
when I run it on iPhone emulator it works well but on iPad give me these issues
[app-scripts] [00:02:36] console.warn: Ionic Native: tried calling StatusBar.styleDefault, but Cordova is not available. Make sure to
[app-scripts] a) run in a real device or simulator and b) include cordova.js in your index.html
[app-scripts] [00:02:36] console.warn: Ionic Native: tried calling SplashScreen.hide, but Cordova is not available. Make sure to a)
[app-scripts] run in a real device or simulator and b) include cordova.js in your index.html
using
cordova v10.0.0
ionic cli v6.11.0
Plugins use the platform's native code. To execute that code, they rely on Cordova. The error message "Cordova is not available" is thrown when the plugin code is executed before cordova has loaded.
You should ensure that all plugin related code is executed only after they have been loaded. You can do this by subscribing to the platform ready event & executing plugin code only after that is fired. An example of this would be import { Platform } from 'ionic-angular';
#Component({...})
export MyApp {
constructor(public plt: Platform) {
this.plt.ready().then((readySource) => {
console.log('Platform ready from', readySource);
// Platform now ready, execute any required native code
});
}
}
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 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.
I am using $cordovaClipboard ng-cordova plugin in my ionic project. http://ngcordova.com/docs/plugins/clipboard/
The plugin works well on Android devices, but when building app for iOS this plugin does not work. Is there something i have missed out on or should consider?
Also, is there a way to run an ionic app on my iOS device or a simulator and at the same time the debug console should also show in terminal?
Debug iOS simulator with Safari
Try removing the iOS platform and readding it. It will re-add every plugin.
ionic platform remove ios
ionic platform add ios
I am trying to create a simple project with last phonegap version:
$ phonegap create my-project
$ phonegap build ios
$ phonegap install ios
All works perfectly and I see emulator with my simple application.
But I can't find documentation on how to run my application on device(iphone, for example) and not on a simulator.
All documentation by cordova / phonegap based on examples with cordova's template for xcode.
But last cordova's version don't have template for xcode and all that I need - cli, if I understand correctly?
I already registered as IOS developer and I have a valid iPhone development certificate.
When I connect my device - I can see it in xcode and I can run native application on my device.
But only via xcode.
I will be grateful to any advice.
If the cordova app builds and runs on the simulator, try running cordova run ios --device
This worked for me, when before it was only hitting the simulator.
Alternatively, if that STILL doesn't work for you, when you run codova build ios, to just build the app, you could use itunes to sync the generated .app file in <project_folder>/platforms/ios/build/device/AppName.app
There is an Apple CLI tool canned xcodebuild, as well as this wrapper around it by Facebook. I'd suggest trying out either that or look at the build-in xcodebuild shipped with xcode.
Hopefully one of them will work.
https://github.com/facebook/xctool
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html
If you use Cordova CLI, you should be able to do this:
cordova run ios