cordova在Windows OS上构建iOS应用. npm运行cordova-build-ios [英] cordova build iOS App on windows os. npm run cordova-build-ios

查看:102
本文介绍了cordova在Windows OS上构建iOS应用. npm运行cordova-build-ios的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照本教程在Windows计算机上构建应用程序.

I have followed this tutorial to build applications on my windows machine.

https://www.npmjs.com/package/vue-cli -plugin-cordova

我安装了android studio,java jdk 1.8,gradle和android sdk,以便为android构建.然后我运行以下命令:

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 

我得到了想要的apk. 现在,我要使用以下命令构建一个iOS应用:

I get my desired apk. Now I want to build an iOS-app with following command:

npm run cordova-build-ios

我必须安装什么?我需要安装虚拟机,mac os,然后安装xcode吗?我可以使用源代码维护现有的项目结构吗?

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?

我必须在config.xml中添加什么?我使用axios,并希望通过http访问xampp服务器.

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="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吗?

Another question: can I build apk for android on a mac machine?

这更好:

允许安卓电话; npm运行cordova-build-ios; npm运行cordova-build-android; whatsapp

推荐答案

您无法在Windows OS上构建iOS应用-您将需要Mac OS X操作系统.

You can't build an iOS app on Windows OS - you will need the Mac OS X operating system.

Cordova iOS文档包含有关您需要安装哪些工具.

The Cordova iOS documentation has a guide on which tools you need to install.

这篇关于cordova在Windows OS上构建iOS应用. npm运行cordova-build-ios的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆