How to generate ionic apk or ios without extra applications? - ios

Is there any ways to generate apk or ios file with using only node.js ?
most of solutions doesn't work or need some addition applications to build the application as apk/ios.

The solution of generating our application as "apk" or "ios" are so easy and fast and first of all open cmd screen with path of your application by using "shift + right click" on any place of your app folder > "open command windows here" and follow the steps
For APK, enter:
ionic package build android
For IOS, enter:
ionic package build ios
This process will take few minutes (just wait until the end)
Next step To download our apk/ios file, just enter:
ionic package download
when downloading completed, you will find the apk/ios file in the same path of your application
Very important note: sometime downloading process will display error message such as "your application not ready to download".
The solution very simple, just try to wait one or two minutes and re-write downloading command.
Finally, These commands tested on Ionic 2 so I'm not sure if its works with other Ionic versions.

Related

Themeablebrowser/Themeablebrowser-wkwebview bring error during running ios .ipa

Due to the latest policy of app store, I need to remove the uiwebview and replace into wkwebview. I tried a lot of way and currently I stuck with the themeable browser. It seems like this plugin is the main problem as when I removed this, I achieved to upload it into the app store. Before this, my .ipa have been rejected eventually after I uploaded it in xcode. Then, (I don't know what is the cause or because of my multiple try and error experiment), the present of themeablebrowser bring error when I run the project on ipad or build it. While, before this my apps can run smoothly with it. This plugin is important for me to access another url.
Below are my code;
Uninstall & remove themeable browser
ionic cordova plugin rm cordova-plugin-themeablebrowser
npm uninstall #ionic-native/themeable-browser
Install and add themeablebrowser-wkwebview. Below are my codes and the error produced;
npm install cordova-plugin-themeablebrowser-wkwebview
cordova plugin add cordova-plugin-themeablebrowser-wkwebview
error archive failed - when running on ipad
I keep repeating the same process like removing the themeablebrowser-wkwebview plugin and add the themeablebrowser again, and get this
Is there any solution regarding this? Thank you.. 🙏

Alternative for hybrid web app without knowledge in app/server

i used to upload my ZIP (with HTML5/CSS web app) in phonegap since 4, 5 years and create cool mobile apps. But since some months it's look like Adobe dismiss the project, no more answer on forum etc.
Is there a good solution, when you don't know everything about shift/cocoa/java and server things, to simply upload your webapp (basically a website in a zip) and get IPA/APK ?
I heard about monaco or voltbuilder. Thanks
Not really. Although I can confirm https://build.phonegap.com works for me. If you have an error related to a malformed xml, you can try to delete the project on the website and re-uplading the zip file onto a new project. That's a bug I have experienced in the past.
Otherwise, you can install Cordova and Phonegap on your pc to build it using npm on the terminal (Linux/MacOs).
$ sudo npm install -g cordova
or for windows (CMD):
C:\> npm install -g cordova
then navigate with the command line using cd to go to a folder
eg. cd myfolder.
You can see the files in your current directory with ls (Linux/MacOs) or lsdir (windows)
Once you are in your project's folder and that you can see with lsdir or ls your config.xml file of your project, then you can run those commands to add the platform you want to build:
cordova platform add ios
cordova platform add android
Finally to build the app, you need to:
cordova build
Note: To build an Ipa, you will need to use a device running MacOs since it requires XCode. I highly recommand you to get familiar with Cmd or the terminal if you are building an app.
I hope I have answered your question well

Can't build Cordova iOS project using CLI but can build/run the Xcode project

Absolutely new to Cordova. These are the steps I've done:
Checked out an existing project
run cordova build ios
The above generates this build error:
(node:10242) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. (The platform "ios" does not appear to be a valid cordova platform. It is missing API.js. ios not supported.)
I've Googled for a solution to the above and the general consensus seems to be to remove and then add the iOS platform.
Now there's a problem with that. Looking through the commit history, I can see that there have been code changes done to files within the platforms directory so I can't just remove it, or...
Question 1)
Can I?
Question 2)
Is it right to make code changes within the platforms directory? Because it seems like those are generated directories.
Question 3)
Why is it that when I open the Xcode project under platforms/ios, I am able to build/run it fine despite the Cordova CLI error above?
it's not right to manually edit the platform files. And some manual changes might make the project not build, so might be related to the manual changes somebody did. So if you don't want to risk to remove the platform, continue building from Xcode
from root www to platforms/ios is transferred by cordova commands such us cordova prepare ios or cordova build ios or cordova run ios.
So if you can't do a cordova prepare ios because of that error you can try a few things.
Copy your files from www to platforms/ios without replacing the whole folder, just the duplicate files. cordova prepare ios is not just a copy, it's also does some modifications/aditions, but if you don't remove existing files it might work.
Create a new project and copy the platforms/ios/cordova to your own project and see if that fixes the mentioned problem, as that's where the Api.js file is.
Downgrade the Cordova CLI, try to latest 7.x.x and if it doesn't work, try with latest 6.x.x, one of those won't require the Api.js as it relatively new.

Cordova and ios-deploy causes builds to fail with "codesign exit code 1"/ "permission denied"

I'm working on a Cordova based mobile application, and wanted to make use of the Cordova CLI's ability to deploy and run my mobile app right from the command line, without having to go into XCode to do the build
When doing:
cordova run ios --device
Cordova graciously tells you that you should install the ios-deploy node module. I did so following the steps on their GIT site.
When I next tried to do a run, I started to get codesign errors, specifically:
/Users/blahblah/platforms/ios/build/device/myApp.app: Permission denied
Command /usr/bin/codesign failed with exit code 1
I couldn't get the code signing to work from Terminal, and worse, going back into XCode resulted in the same error!
Fortunately the error messages says it all: permission denied; I was able to correct this by popping back into Terminal and running a chmod on my entire app folder, i.e.:
chmod -R a+rwx myApp
I could then go back into XCode and get the project building and deploying again (whew!), however if I tried to do the deploy via the Cordova CLI, then same issue would occur.
It seems like the ios-deploy and / or cordova is messing around with the folder permissions, but I'm not sure how to correct this.
Any suggestions would be appreciated!
UPDATE:
To be clear, I am able to successfully sign the app within XCode if I first go into Terminal, and then into the platforms/ios folder and perform a chmod -R a+rwx on the "www" folder.
The problem I'm having is trying to get this to build / sign successfully from the command line.
I've done some further diagnosis, and it seems that the problem is with the Cordova CLI itself, and not with ios-deploy; when I execute:
cordova prepapre
It copies my "www" folder over to the "platforms/ios/www", however it changes the permissions when doing so from everyone having write access (i.e.: drwxrwxrwx) to only my user having write access i.e.: (drwxr-xr-x)
It seems that this is fouling up the codesign application, and is causing my permission denied errors above.
I'm just hoping someone knows how I can work around this, or what I might be doing wrong with my build - I'd prefer not to have to go into XCode to do these builds.
So it turns out that the Cordova CLI is working just fine, as is the ios-deploy npm package.
The problem turns out to be within the solution itself, and has nothing to do with the tools.
I am using the Ionic framework within this particular Cordova application, and their framework installs some "after_prepare" hooks (within the hooks folder) which attempt to help prepare / clean up some extraneous files prior to the build.
One of these hooks (named "020_remove_sass_from_platform.js") was trying to help out by cleaning up unneeded SASS files prior to the build in order to reduce the size of the compiled app.
Unfortunately this hook was adjusting the folder permissions (I guess in order to ensure the delete could succeed), and this was the cause of the "www" folder's permissions changing during a "cordova prepare".
I deleted the hooks, and now the Cordova CLI builds and signs the APK as expected, and the ios-deploy package pushes it to the device, all without using XCode.
Hope this can be of some help to someone else.
Check the CODE_SIGN_IDENTITY property in your build settings. Is your provisioning profile selected there?
You also need to enter a valid bundle identifier in your apps .plist.
The identifier has to match the one you provided when generating the profile.
Try this
sudo npm install -g ios-deploy --unsafe-perm

How to get links to open in the native browser in iOS Meteor apps?

How do I prevent external links from opening in the in-app browser in apps built with Meteor for iOS? I want them to open in Safari instead.
You'll need to download and install an apache cordova plugin to add this functionality into your meteor ios app.
Simply run this command into your terminal
meteor add cordova:cordova-plugin-inappbrowser#https://github.com/apache/cordova-plugin-inappbrowser/tarball/ba7cbe58d5812b51c3ece1
(here is a ref to the tarball/ba7cbe58d5812b51c3ece1) (use the latest commit to master branch)
Then simply add this into your meteor template to launch the system default browser app with the external link:
<a href="" onclick="window.open('http://www.example-url.com', '_system');">
Hope this helps!
</a>
Run:
meteor run ios-device
(select your trusty simulator and test her out)
Nick's answer to use the inappbrowser Cordova plugin is sound, but with the error you're seeing, make sure you're providing a full commit hash URL for the meteor tool/build to resolve. At the time of this writing, the correct Terminal command to use the latest commit is:
meteor add cordova:cordova-plugin-inappbrowser#https://github.com/apache/cordova-plugin-inappbrowser/tarball/bc9036d90a1f3f2220b5fc29b77cf2405e7fd781
The remaining steps are the same; use the _system target in your project's code for the link:
Open
Then kick off a meteor build for your desired mobile platform and Cordova should apply the plugin without issue. Verified these steps work on Meteor 1.2.1.

Resources