如何在Windows 10移动电话上测试Ionic 2应用程序? [英] How do I test Ionic 2 apps on a Windows 10 Mobile Phone?

查看:146
本文介绍了如何在Windows 10移动电话上测试Ionic 2应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难找到有关Windows 10手机测试的有意义的文档。我添加了win 10作为平台,它创建了一个项目文件夹,但是从这一点开始不清楚该怎么做。有没有人通过这个过程?

I'm struggling to find meaningful documentation on testing for Windows 10 phone. I've added win 10 as platform and it creates a project folder, but it's not clear what to do from this point on. Has anyone worked through this process?

推荐答案

好的,所以我经历了大约8个小时(我认为很大一部分问题是期望一个网站会有所需的所有信息(即Ionic的文档),但最终需要来自Ionic,Cordova和Microsoft的信息。无论如何,这是我的笔记:

OK, so I worked through it for about 8 hours (I think a big part of the problem was expecting a single site would have all the information required (i.e. Ionic's docs), but in the end it needed info from Ionic, Cordova and Microsoft. Anyway, here are my notes:

确保您运行'离子平台添加窗口'。
从平台/打开Windows 10项目windows文件夹(你可以打开解决方案,但如果你这样做,确保将win 10项目设置为默认启动)。
将cpu类型设置为windows-ARM(对于Lumia 550)。

Ensure you've run 'ionic platform add windows'. Open the windows 10 project from the platforms/windows folder (you can open the solution, but if you do, ensure the win 10 project is set as default startup). Set cpu type to windows-ARM (for the Lumia 550).

打开config.xml(设计器视图)并将任何API端点添加到''域访问'列表中'常用'tab。
您可以在此处找到有关config.xml的更多信息:
Cordova:Config.xml

Open config.xml (designer view) and add any API endpoints to the 'Domain Access' list in the 'Common' tab. You can find out more about the config.xml here: Cordova: Config.xml

在Windows选项卡下,确保Windows 10是目标版本。

Under the 'windows' tab, make sure Windows 10 is the target version.

Win phone aps需要本地存储的证书才能通过SSL访问资源。

Win phone aps require a locally-stored certificate to access resources over SSL.

从服务器下载证书
(通过浏览器,点击挂锁或类似物品并保存为DER类型 - 出于某种原因具有.cer扩展名)。
将证书保存到项目根目录,例如'api-certificate.cer'

Download the cert from the server (do it via browser, click on padlock or similar and save as DER type - which has .cer extension for some reason). Save cert to project root e.g. 'api-certificate.cer'

将以下内容添加到package.windows10..appxmanifest

add the following to package.windows10..appxmanifest

<Extensions>
    <!--Certificates Extension-->
    <Extension Category="windows.certificates">
        <Certificates>
            <Certificate StoreName="Root" Content="api-certificate.cer" />        
        </Certificates>
    </Extension>
</Extensions>

如果需要,可以通过这种方法添加额外的证书(我猜)。

If required, additional certs could be added via this method (I guess).

确保在项目中包含.cer,因为它需要包含在构建的包中。

Ensure to include the .cer in the project, as it will need to be included in the built package.

调试过程可能需要一堆默认情况下未复制到包中的二进制文件。
对我来说,它不是复制SqlLite,需要将其复制到调试文件夹和任何特定于芯片架构的依赖文件夹,如ARM。你会得到错误,显示哪些文件丢失(我甚至为他们创建了空文件夹)。

The debugging process might require a bunch of binaries that aren't copied into the package by default. For me, it wasn't copying SqlLite, which needs to be copied to the debug folder and any chip-architecture-specific dependency folders such as ARM. You'll get errrors which show which files are missing (I even had empty folders created for them).

在VS中构建应用程序(您可以使用'离子构建窗口'进行构建,但这对我来说是失败的,因为它试图构建生成的Windows项目而不先设置cpu架构)。
转到项目文件夹>平台>窗口并打开cordovaapp.sln。
将windows 10项目设置为默认启动并检查它是否设置为windows-ARM。

Build the app in VS (you can build with 'ionic build windows' but this has been failing for me since it tries to build the generated windows project without setting the cpu architecture first). Go to projectfolder > platforms > windows and open the cordovaapp.sln. Set the windows 10 project to be startup default and check that it's set to windows-ARM.

构建解决方案。

MSDN:打包UWP应用程序

确保win 10项目的appxmanifest文件包含数据API的内容URI:

Make sure the win 10 project's appxmanifest file contains a content URI for the data API:

https://api.example.com (规则:包括和WinRT:所有)

https://api.example.com (Rule: include and WinRT: all)

将api-certificate.cer文件复制到platform> windows文件夹(或使用./reload-platform windows powershell脚本)。

Copy the api-certificate.cer file into the platform > windows folder (or use the ./reload-platform windows powershell script).

转到项目>商店>创建应用包。

为本地包创建选择否并按照向导(问题只需选择)正确的架构)。
API的.cer文件将包含在包中。

Go to project > store > create app package.
Select 'No' for local package creation and follow wizard (prob. only need to choose the right architecture). The .cer file for API will be included in the package.

将使用[projectName]在AppPackages文件夹中创建包。[verion]文件夹名称。

The package will be created in the AppPackages folder with a [projectName].[verion] folder name.

如果它在USB连接的设备上运行,那么它可能可以部署到应用商店。

If it's running on a USB-attached device, then it's probably deployable to the app store.

以下是有用资源的粗略组合:

Here's a rough assemblage of useful resources:

TACO-VS:打包Windows应用程序
MSDN:侧载或开发者模式?
Technet:Windows 10中的侧载应用

MSDN:启用侧载

在您要启用的设备上,转到设置。选择更新&安全性,然后选择开发人员。
选择您需要的访问级别 - 开发UWP应用程序,选择开发者模式,否则选择侧载应用程序。
阅读您选择的设置的免责声明,然后单击是接受更改。

On your device that you want to enable, go to Settings. Choose Update & security, then choose For developers. Choose the level of access that you need - to develop UWP apps, choose Developer Mode, otherwise choose 'sideload apps'. Read the disclaimer for the setting you chose, then click Yes to accept the change.

可选:使用winappdeploycmd.exe部署

(MSDN:使用WinAppDeployCmd.exe部署UW应用程序)( https://msdn.microsoft.com/windows/uwp/packaging/install-universal-windows-apps-with-the-winappdeploycmd -tool

(MSDN: Using WinAppDeployCmd.exe for deploying UW apps](https://msdn.microsoft.com/windows/uwp/packaging/install-universal-windows-apps-with-the-winappdeploycmd-tool)

在本地检查可用设备
C:\Program Files(x86)\Windows Kits\ 10 \bin\x86 \winappdeploycmd devices

Check available devices locally C:\"Program Files (x86)"\"Windows Kits"\10\bin\x86\winappdeploycmd devices

注意:这个过程(winappdeploycmd)可能用处不大,因为我们要么将文件提供给非托管设备客户或
让他们从应用程序商店下载,但它可能有助于代替visual studio。

Note: this process (winappdeploycmd) probably isn't much use, since we'll either give files to unmanaged-device customers or let them download it from app store, but it may be useful in lieu of visual studio.

通过USB连接手机到电脑a并将新建文件夹中的两个文件复制到手机上(例如下载文件夹):

Connect the phone to PC via USB and copy two files from the newly-built folder on to the phone (e.g. the downloads folder):

示例文件名

CordovaApp.Windows10_0.0.2 .0_arm.cer
CordovaApp.Windows10_0.0.2.0_arm.appxbundle

CordovaApp.Windows10_0.0.2.0_arm.cer CordovaApp.Windows10_0.0.2.0_arm.appxbundle

打开手机上的文件资源管理器,然后先点击.cer(证书)。让它安装。

安装证书允许支持侧载的系统安装包含该应用程序的签名appxbundles。
接下来,单击appxbundle文件并让它也安装(等待30秒,因为它仍然在后台安装)。
注意:除非已经出现在最近项目列表中,否则不要尝试打开应用程序,
否则由于资产缺失而会出现一些无提示错误,屏幕将变为空白或仅返回设备主菜单。

Open File Explorer on the phone and click the .cer (certificate) first. Let it install.
Installing the certificate allows a sideload-enabled system to install signed appxbundles containing the app. Next, click on the appxbundle file and let that install too (wait for 30 secs as it is still installing in background). NOTE: Do not try to open the app unless it has appeared in the 'recent items' list, otherwise you'll get some silent errors due to missing assets and the screen will go blank or just return to device home menu.

一旦它出现在应用程序菜单中,您就可以正常加载。

Once it's appeared in the apps menu, you can load normally.

使用开发人员许可证,可以在提交到应用程序商店之前验证应用程序。

With a developer license, apps can be validated before submittal into the app store.

MSDN:验证包

MSDN:使用Windows应用程序认证工具包

这篇关于如何在Windows 10移动电话上测试Ionic 2应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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