设备上的iOS单元测试无法启动-HealthKit权利错误 [英] iOS on device Unit Testing fails to start - HealthKit entitlements error

查看:256
本文介绍了设备上的iOS单元测试无法启动-HealthKit权利错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试在设备上运行单元测试时.一切似乎都已构建并安装到设备上,但是在其将要运行时,在对话框中出现以下错误:

Whenever I try to run the unit tests on device. Everything seems to build and install onto the device but I get the following error in a dialog when it is about to run:

可执行文件已使用无效的权利进行签名.应用程序的代码签名权利"文件中指定的权利无效,不允许或与您的配置文件中指定的权利不匹配. (0xE8008016).

The executable was signed with invalid entitlements. The entitlements specified in your application’s Code Signing Entitlements file are invalid, not permitted, or do not match those specified in your provisioning profile. (0xE8008016).

在模拟器上进行单元测试可以正常工作.但是,我想让单元测试在该设备上工作,因为它可以更快地工作.

Unit testing on simulator works fine. However I would like to get unit tests to work on the device, because it will work a bit faster.

我的项目有以下警告:

示例"的供应配置文件匹配开发com.example.app"包含的权利不在权利文件中:com.apple.developer.healthkit.access.要使用这些权利,请将它们添加到您的权利文件中.否则,请从您的配置文件中删除未使用的权利.

Provisioning profile "match Development com.example.app" for "Example" contains entitlements that aren't in the entitlements file: com.apple.developer.healthkit.access. To use these entitlements, add them to your entitlements file. Otherwise, remove unused entitlements from your provisioning profile.

但是其他所有方法都可以运行,我可以运行目标并将其发布到appstore.仅设备上的单元测试无法启动.我查看了开发配置文件的内部,发现其中包含com.apple.developer.healthkit.access密钥,该密钥不在appstore的配置文件中.但是,当我将此密钥添加到权利文件中时,它仍然无法运行单元测试.

But everything else works, I can run the target and publish it to appstore. Only unit testing on device fails to start. I looked inside the development provisioning profile and found it contains the com.apple.developer.healthkit.access key which is not in the appstore provisioning profile. But when I add this key to the entitlements file, it still does not run the unit tests.

我尝试删除权利文件并让Xcode重新生成它,但这不起作用.我的项目有5个不同的应用程序目标,每个目标都有各自的单元测试包.

I have tried deleting the entitlements file and letting Xcode regenerate it, but that does not work. My project has 5 different app targets each with their own unit testing bundle.

我也尝试过重新生成开发配置文件,但是它始终包含一个com.apple.developer.healthkit.access密钥.

I have also tried regenerating the development provisioning profile, but it always has a com.apple.developer.healthkit.access key in it.

我按照建议的此处查看了项目文件.我发现所有应用程序目标都使用相同的权利文件.因此,我对其进行了更改,以便所有应用程序都使用自己的权利,但是单元测试仍然无法启动.而com.apple.developer.healthkit.access警告停留在那里

I looked in the project file as suggested here. All I found was that all the app targets were using the same entitlements file. So I changed it so that all the apps use their own entitlements, but unit testing still fails to start. And the com.apple.developer.healthkit.access warning stays there

有没有一种方法可以使设备上的单元测试与Healthkit一起使用?在没有HealthKit的设备上进行单元测试也将有所改进,但是其他所有内容(分发等)也应该可以工作

Is there a way I can get unit testing on device to work with healthkit turned on? Unit testing on device without HealthKit will also be an improvement, but then everything else should also work (distribution etc...)

推荐答案

确保测试目标使用自动签名,并确保它与应用程序目标使用相同的团队.还要确保他们使用相同的证书.

Make sure the test target uses automatic signing and make sure it uses the same team as the app target. Also make sure they are using the same certificates.

com.apple.developer.healthkit.access警告似乎无关

此答案可能是对

This answer might be an answer to this question for problems related to unit testing on device.

这篇关于设备上的iOS单元测试无法启动-HealthKit权利错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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