Ionic native plugin not working after build --prod - ios

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!

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.

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

I can’t get my iOS project to build my changes

I'm new to the iOS side of things and I’m having a huge issue. None of my changes I am making to my views are being built when I build iOS. I run
sudo cordova build ios
Then I open Xcode and “sign” it. I then run from Xcode to my test device. But no changes are made. Even when I remove the iOS platform, add it back, rebuild iOS, run from Xcode, my changes still have not taken effect in the build. Am I missing something?
After you update your view, the process is:
1. build the components and pages and copy the result into www dir.
2. copy the contents in www into ios project, with ionic prepare command.
3. build your ios project.
With the latest version of ionic, it will be done one one command ionic cordova build ios, but if you use some old version of ionic, maybe you need to run:
ionic build
ionic cordova build ios

Ionic building an IOS application

I have finished building and compiling the Android version of the application from my windows laptop.
But to run it on IOS, am I supposed to copy the application folder to a MAC computer and run "ionic run ios"?
Follow these steps.
Check whether Ionic is already installed in Mac by typing ionic -v.
If Ionic is already installed, type the following commands:
ionic platform add ios.
ionic build ios.
If Ionic is not installed yet,
First install Node.js in Mac.
Then install Cordova and Ionic by using this command:
npm install -g cordova ionic
Once done with the installation, use the above commands for adding platform and build.
Then you will able to see Xcode file in platform folder iOS.
Then you can ask iOS developer to generate ipa file for iOS build.
You should add ionic ios platform before build
ionic platform add ios
Read this link : Ionic build

How to include phonegap application in the iOS

I am creating a phonegap application in ios and i am following below mentioned link
http://docs.phonegap.com/en/1.9.0/guide_getting-started_ios_index.md.html
It is said in the link that we need to download the phone gap, which i had done already
and then click on the cordova based application, but in my app I am not getting the options
to select the same.
So can anyone suggest how it can be done?
PhoneGap installation process has been changed. You will not get any template in Xcode and we can do is creating app in terminal
List of this you need to install phoneGap are
1. node.js
2. cordova
3. phonegap
first install node.js and then phone gap/cordova
once your installation is completed open terminal and then create a cordova based application
use this for creating process
http://cordova.apache.org/docs/en/3.3.0/guide_cli_index.md.html
this for plugins
http://docs.phonegap.com/en/3.4.0/cordova_plugins_pluginapis.md.html#Plugin%20APIs
cd to your workspace
cd /Users/xxxx/Desktop
create cordova project
cordova create your-project-name
cd to your project
cd your-project-name
add ios platform
cordova platform add ios
build your project using cordova build
cordova build ios
done !!
Reference: http://blog.revivalx.com/2014/02/21/crud-operation-using-jquery-mobile-on-android-part-1/

Resources