xcode 尝试运行单元测试时出现“未找到此可执行文件的有效配置文件”错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22993092/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"A valid provisioning profile for this executable was not found" error when trying to run unit tests
提问by Kristopher Johnson
I have an Xcode workspace with unit test targets. The unit tests run fine in the simulator, and also run fine on one of my devices (a 4th-gen iPod touch running iOS 6). However, on two other devices (an iPad Air and a 5th-gen iPod touch running iOS 7), when I try to run unit tests I get an alert saying
我有一个带有单元测试目标的 Xcode 工作区。单元测试在模拟器中运行良好,并且在我的一台设备(运行 iOS 6 的第 4 代 iPod touch)上也运行良好。但是,在其他两台设备(iPad Air 和运行 iOS 7 的第 5 代 iPod touch)上,当我尝试运行单元测试时,我收到一条警告说
A valid provisioning profile for this executable was not found
I only get this when running unit tests. If I try to Runthe app on these devices, it installs and runs fine.
我只在运行单元测试时得到这个。如果我尝试在这些设备上运行该应用程序,它会安装并运行良好。
I have verified that the (developer) provisioning profile set in the Code Signingbuild settings for the app includes these devices and that it matches my developer code-signing identity and the App ID. I have also tried recreating, re-downloading, and re-installing the profile.
我已验证在应用程序的代码签名构建设置中设置的(开发者)配置文件包括这些设备,并且它与我的开发者代码签名身份和应用程序 ID 匹配。我也尝试过重新创建、重新下载和重新安装配置文件。
Where should I look? Why would the provisioning profile for Testnot be valid when it is valid for Run?
我应该在哪里看?为什么Test的配置文件在Run有效时无效?
回答by us_david
I was running into similar error when installing app to iPhone 5 & iPhone 6. The same app install just fine (using Xcode 6). But it kept giving me errors like:A valid provisioning profile for this executable was not found
The code signing and profile setting were good and valid. I tried different ways people have suggested but none of them solve my problem. If you are running into the similar problem when trying to run your app on iPhone 5 & above, and getting the error message, here is what you can try:
1) Go to apple developer web site and add the device (iPhone 5/6) to the development device list;
2) On the same web site, click on Provisioning profile and download development provisioning profile to your local computer;
3) Go to Xcode -> Devices, right click on the iPhone you want to run your app (which you added it to your development device list on apple developer web site);
4) Select "Show Provisioning Profiles". A popup window will show the profiles for the device. Click on "+" sign and select the provisioning profile you just downloaded.
The profile will be installed for this device and you are ready to go.
I have found this procedure works whenever you want to add a new phone for development.
在将应用程序安装到 iPhone 5 和 iPhone 6 时,我遇到了类似的错误。同一个应用程序安装得很好(使用 Xcode 6)。但它不断给我错误,例如:A valid provisioning profile for this executable was not found
代码签名和配置文件设置良好且有效。我尝试了人们建议的不同方法,但没有一个能解决我的问题。如果您在尝试在 iPhone 5 及更高版本上运行您的应用程序时遇到类似问题,并收到错误消息,您可以尝试以下方法:
1) 转到苹果开发者网站并添加设备 (iPhone 5/6 ) 到开发设备列表;
2)在同一个网站上,点击Provisioning profile,将开发provisioning profile下载到本地;
3) 转到 Xcode -> Devices,右键单击要运行应用程序的 iPhone(已将其添加到苹果开发者网站上的开发设备列表中);
4) 选择“显示配置文件”。一个弹出窗口将显示设备的配置文件。单击“+”号并选择您刚刚下载的配置文件。
将为此设备安装配置文件,您就可以开始使用了。
我发现只要您想添加新手机进行开发,此过程都可以使用。
回答by Kristopher Johnson
After a lunch break, I figured this out: The Bundle Loadersetting for the unit-test target was not referring to the application target I thought it was. It was, in fact, pointing at a target with an invalid provisioning profile.
午休后,我发现了这一点:单元测试目标的Bundle Loader设置并不是指我认为的应用程序目标。事实上,它指向了一个配置文件无效的目标。
It's interesting that the unit tests did run on an iOS 6 device, even with the incorrect profile. I guess iOS 7 does some additional verification.
有趣的是,单元测试确实在 iOS 6 设备上运行,即使配置文件不正确。我猜 iOS 7 做了一些额外的验证。