Reputation: 87
I have followed this tutorial to build applications on my windows machine.
https://www.npmjs.com/package/vue-cli-plugin-cordova
I installed android studio, java jdk 1.8, gradle and android sdk to build for android. Then I ran following command:
npm run cordova-build-android
I get my desired apk. Now I want to build an iOS-app with following command:
npm run cordova-build-ios
What do I have to install? Do I need to install a virtual machine, mac os and then xcode? Can I maintain my existing project structure with my source code?
What do I have to add in my config.xml? I use axios and want to access xampp server with http.
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.demo.app"
version="1.0.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<name>VueExampleAppName</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="[email protected]" href="http://cordova.io">
Apache Cordova Team
</author>
<!-- this hook will point your config.xml to the DevServer on Serve -->
<hook type="after_prepare" src="../node_modules/vue-cli-plugin-cordova/serve-config-hook.js" />
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="electron">
<preference name="ElectronSettingsFilePath" value="res/electron/settings.json" />
<icon src="res/icon/electron/foreground.png" />
</platform>
<platform name="android">
<allow-intent href="market:*" />
<icon background="res/icon/android/background.png" density="ldpi" foreground="res/icon/android/foreground.png" />
<icon background="res/icon/android/background.png" density="mdpi" foreground="res/icon/android/foreground.png" />
<icon background="res/icon/android/background.png" density="hdpi" foreground="res/icon/android/foreground.png" />
<icon background="res/icon/android/background.png" density="xhdpi" foreground="res/icon/android/foreground.png" />
<icon background="res/icon/android/background.png" density="xxhdpi" foreground="res/icon/android/foreground.png" />
<icon background="res/icon/android/background.png" density="xxxhdpi" foreground="res/icon/android/foreground.png" />
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera2" />
</config-file>
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:usesCleartextTraffic="true" />
</edit-config>
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
Another question: can I build apk for android on a mac machine?
This is better:
Allow Phone Call android; npm run cordova-build-ios; npm run cordova-build-android; whatsapp
Upvotes: 0
Views: 1159
Reputation: 884
You can't build an iOS app on Windows OS - you will need the Mac OS X operating system.
The Cordova iOS documentation has a guide on which tools you need to install.
Upvotes: 1