ionic ios build give error whe work on ios - ios

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
});
}
}

Related

IONIC 5 - InAppBrowser is not installed or you are running on a browser -XCODE 13

I have an IONIC 5 / cordova project and I use InAppBrowser to open a link.
In the next code:
const browser = this.iab.create(url);
I get error "WARN: InAppBrowser is not installed or you are running on a browser. Falling back to window.open" on execution time in IOS device and IOS emulator.
I have tried all kinds of things that I have found on the internet:
First, I have done many test with #ionic-native/in-app-browser plugin, but I always get the same result:
Remove node_modules, www, platform/ios
Re-install(remove and install) in-app-browser libraries
Recompile in dev and prod mode.
Same error..
I have tried it again with the new plugin:
$ ionic cordova plugin add cordova-plugin-inappbrowser
$ npm install #awesome-cordova-plugins/in-app-browser
I change the code to get the new native plugin
$ ionic cordova platform add ios
BUILD DEVEL and PROD
$ ionic cordova build ios
$ ionic cordova build ios --prod
Same result.
I have verified that the cordova plugins are installed in the /Plugins folder of the XCode project.
I have a couple of things to comment on:
Now I use XCode 13, but In XCode 12 works fine. To upgrade the XCode I have upgrade MacOS from Catalina To Monterey.
The only difference between the two projects is that in XCode 13 "Legacy build system" is disabled since it's "deprecated".
I don't know if XCode doesn't import the libraries, I don't know if "Legacy Build System" is necessary. I know nothing... :-(
Can anybody help me?
Thanks.
I found the problem.
In my project I have an "Object.prototype" function that it produce a big problem to loop objects.
Referring InAppBrowser pluguin, in file inappbrowser.js:
callbacks = callbacks || {};
for (var callbackName in callbacks) {
iab.addEventListener(callbackName, callbacks[callbackName]);
}
Perhaps it could be improved with an Object.keys(callbacks), but I think that It was my problem.
Thanks.

Ionic native plugin not working after build --prod

I implemented some ionic native plugins in an app (standard install and imported to app.module properly). When I tested it, it worked fine in my DevApp. After I built it with ionic build --prod and open it, my plugins are not working at all. I'm building it as an iOS app. Is there any steps I'm missing?
My steps:
create ionic 4 app
ionic cordova platform add ios
build my app and install plugins
test it on DevApp and it's fine
ionic build --prod (I'm thinking maybe this step is wrong? Should I build in other ways to make native plugins work or included on iOS device?)
Thanks for your help!

Unable to build ionic 3 application for ios using Xcode10

I have created a blank ionic project. And I was successfully able to add android platform. But when I am trying to build it on IOS device (XCode 10) it is freezing as shown in the image.
.
I ran below command to build the project:
ionic cordova run ios -- --buildFlag="-UseModernBuildSystem=0"
I have also tried:
ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"
But no success.
Any help is recommended. I am stuck on it and is not able to resolve it after referring to various posts.
u could try to do this
ionic cordova prepare ios --prod
and the make the build direct on xCode

APP only works the first time on ios

im having a problem since I’m trying to test my app on iOS.
The first time I install my app on an emulator/device the app works correctly. But if I close my app, and open again the app don’t work anymore and get stuck on the white screen forever.
My ionic info is:
cli packages: (/usr/local/lib/node_modules)
#ionic/cli-utils : 1.14.0
ionic (Ionic CLI) : 3.14.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
#ionic/app-scripts : 3.0.1
Cordova Platforms : ios 4.5.2
Ionic Framework : ionic-angular 3.7.1
System:
Node : v8.7.0
npm : 5.4.2
OS : macOS Sierra
Xcode : Xcode 9.0 Build version 9A235
Misc:
backend : pro
I tried so many solutions, like remove and add de platforms, remove and add de plugin one by one. The app works on Android perfectly, but on iOS I have this problem.
Can someone help me?
We can debug ios application
ionic emulate ios -lc
Which runs app using simulator and outputs console logs and errors to terminal with live reloading.
There are three primary options.
Debug using Safari. This is good for debugging a hybrid app, but
cannot tell you output related to native plugins.
http://webdesign.tutsplus.com/articles/quick-tip-using-web-inspector-to-debug-mobile-safari--webdesign-8787
Open the project and build to device in Xcode. This shows the output of the entire device http://cordova.apache.org/docs/en/3.5.0/guide_platforms_ios_index.md.html#iOS%20Platform%20Guide
Debug with Ionic CLI. Using ionic run ios -l -c -s with the flags will use live reload and print the logs to the console. http://ionicframework.com/blog/live-reload-all-things-ionic-cli/
From: Debug Ionic app on IOS?

Using $cordovaClipboard ng-cordova plugin in ionic for iOS

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

Resources