android - cordova 在 Windows 操作系统上构建 iOS 应用程序。npm 运行cordova-build-ios
问题描述
我已按照本教程在我的 Windows 机器上构建应用程序。
https://www.npmjs.com/package/vue-cli-plugin-cordova
我安装了 android studio、java jdk 1.8、gradle 和 android sdk 来为 android 构建。然后我运行以下命令:
npm run cordova-build-android
我得到了我想要的 apk。现在我想使用以下命令构建一个 iOS 应用程序:
npm run cordova-build-ios
我必须安装什么?我需要安装虚拟机、mac os 和 xcode 吗?我可以用我的源代码维护我现有的项目结构吗?
我必须在我的 config.xml 中添加什么?我使用 axios 并想通过 http 访问 xampp 服务器。
<?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="dev@cordova.apache.org" 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>
另一个问题:我可以在 mac 机器上为 android 构建 apk 吗?
这个更好:
允许打电话安卓;npm 运行cordova-build-ios;npm 运行cordova-build-android;whatsapp
解决方案
您无法在 Windows 操作系统上构建 iOS 应用程序 - 您将需要 Mac OS X 操作系统。
Cordova iOS 文档有一个关于您需要安装哪些工具的指南。
推荐阅读
- c++ - 拉普拉斯滤波器opencv c ++
- c# - 使用 js 和 c# 而不是使用 asp.net 将 HTML+CSS 转换为 pdf
- python - 遍历 pandas 中的行以检查条件
- marklogic - MarkLogic - 在 REST API 中使用属性范围索引
- python - 在 Debian 服务器上安装烧瓶的问题
- c++ - 将矢量数据从一类复制到另一类
- coldfusion - 将二进制值转换为字符串并返回二进制?
- python - 如何将属性添加到标准类型?
- c++ - 无法将返回的枚举与枚举进行比较
- java - 如何从我的 EditText 获取带有格式化日期的日期对象(通过 Spinner 存储)