ios Xcode 11.2 - 无法将 App 文件安装到设备?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/58662457/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 10:34:58  来源:igfitidea点击:

Xcode 11.2 - Unable to install App file to device?

iosxcode

提问by Brittany

I recently updated my OS to Catalina, and updated Xcode to 11.2. Since doing so, when I try to run a release version of my app on my device, I'm simply given the error:

我最近将操作系统更新为 Catalina,并将 Xcode 更新为 11.2。由于这样做,当我尝试在我的设备上运行我的应用程序的发布版本时,我只是给出了错误:

Unable to install the app.

无法安装该应用程序。

When I tap 'details', it provides me with the following:

当我点击“详细信息”时,它会为我提供以下信息:

App installation failed Domain: com.apple.dtdevicekit Code: -402620395 Failure Reason: A valid provisioning profile for this executable was not found.

User Info: { DVTRadarComponentKey = 487927; "com.apple.dtdevicekit.stacktrace" = ( 0 DTDeviceKitBase 0x000000011baff6e7 DTDKCreateNSError + 109 1 DTDeviceKitBase
0x000000011baffde9 DTDK_AMDErrorToNSError + 792 2 DTDeviceKitBase
0x000000011bb3f56a 90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 164 3 DVTFoundation 0x000000010356f156 DVTInvokeWithStrongOwnership + 73 4 DTDeviceKitBase
0x000000011bb3f301 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1589 5 IDEiOSSupportCore 0x000000011b9c7a25 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.352 + 4523 6 DVTFoundation 0x00000001036a03ba __DVT_CALLING_CLIENT_BLOCK
+ 7 7 DVTFoundation 0x00000001036a1a92 __DVTDispatchAsync_block_invoke + 809 8
libdispatch.dylib 0x00007fff68220583 _dispatch_call_block_and_release + 12 9 libdispatch.dylib 0x00007fff6822150e _dispatch_client_callout + 8 10 libdispatch.dylib 0x00007fff68226ace _dispatch_lane_serial_drain + 597 11 libdispatch.dylib 0x00007fff68227452 _dispatch_lane_invoke + 363 12 libdispatch.dylib 0x00007fff68230a9e _dispatch_workloop_worker_thread + 598 13 libsystem_pthread.dylib 0x00007fff6847a71b _pthread_wqthread + 290 14 libsystem_pthread.dylib 0x00007fff6847a57b start_wqthread + 15 ); }

应用程序安装失败域:com.apple.dtdevicekit 代码:-402620395 失败原因:找不到此可执行文件的有效配置文件。

用户信息:{ DVTRadarComponentKey = 487927; “com.apple.dtdevicekit.stacktrace”=(0 DTDeviceKitBase 0x000000011baff6e7 DTDKCreateNSError + 109 1 DTDeviceKitBase
0x000000011baffde9 DTDK_AMDErrorToNSError + 792 2 DTDeviceKitBase
0x000000011bb3f56a 90- [DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] _ block_invoke + 164 3 DVTFoundation 0x000000010356f156 DVTInvokeWithStrongOwnership + 73 4 DTDeviceKitBase
0x000000011bb3f301 - [DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1589 5 IDEiOSSupportCore 0x000000011b9c7a25 __118- [DVTiOSDevice(DVTiPhoneApplicationInstallation)processAppInstallSet:appUninstallSet:installOptions:completionBlock:] _ block_invoke.352 + 4523 6 DVTFoundation 0x00000001036a03ba __DVT_CALLING_CLIENT_BLOCK
+ 7 7 DVTFoundation 0x00000001036a1a92 __DVTDispatchAsync_block_invoke + 809 8
libdispatch.dylib 0x00007fff68220583 _dispatch_call_block_and_release + 12 9 libdispatch.dylib 0x00007fff6822150e _dispatch_client_callout + 8 10 libdispatch.dylib 0x00007fff68226ace _dispatch_lane_serial_drain + 597 11 libdispatch.dylib 0x00007fff68227452 _dispatch_lane_invoke + 363 12 libdispatch.dylib 0x00007fff68230a9e _dispatch_workloop_worker_thread + 598 13 libsystem_pthread.dylib 0x00007fff6847a71b _pthread_wqthread + 290 14 libsystem_pthread。动态库 0x00007fff6847a57b start_wqthread + 15); }

My provisioning profiles are 100% correct, as are my certificates. I have no idea why this is happening, and I've tried absolutely everything to get it to install/run. I've tried:

我的配置文件 100% 正确,我的证书也是如此。我不知道为什么会发生这种情况,我已经尝试了所有方法来安装/运行它。我试过了:

  • Double checked that 'Scheme' has release checked under the 'Run' tab
  • Confirmed that correct provisioning profile is selected
  • Removing the app from my device
  • Creating new provisioning profiles
  • Changing my bundle ID
  • Creating new certificates
  • Cleaning the build folder, restarting Xcode
  • Reinstalling Xcode
  • Deleting the Derived Data folder
  • 在“运行”选项卡下仔细检查“方案”是否已发布
  • 确认选择了正确的配置文件
  • 从我的设备中删除应用程序
  • 创建新的配置文件
  • 更改我的捆绑 ID
  • 创建新证书
  • 清理构建文件夹,重新启动 Xcode
  • 重新安装Xcode
  • 删除派生数据文件夹

NONE of the above has worked.I've been at this for 2 days now - help is appreciated. The only way I'm able to install the app file successfully to my device is if I upload it to TestFlight first (which, I can't feasibly do every time I want to test a small change).

以上都没有奏效。我已经在这里呆了 2 天了 - 非常感谢您的帮助。我能够将应用程序文件成功安装到我的设备的唯一方法是,如果我先将它上传到 TestFlight(每次我想测试一个小的更改时,我都不可能这样做)。

回答by Lean van Heerden

Go to File -> Workspace Settings, and make sure your build system is set to Legacy Build System.

转到 File -> Workspace Settings,并确保您的构建系统设置为 Legacy Build System。

I ran into the same issue on Catalina and Xcode 11.2 and this solved it for me.

我在 Catalina 和 Xcode 11.2 上遇到了同样的问题,这为我解决了。

As of Xcode 11 Apple is starting to enforce some of the build criteria that was previously only required for AppStore builds on .ipa extraction, and device builds.

从 Xcode 11 开始,Apple 开始强制执行一些构建标准,以前这些标准仅适用于基于 .ipa 提取和设备构建的 AppStore 构建。

So far I have encountered:

到目前为止我遇到过:

  • Requiring the above legacy build system setting for device deployments for older projects or projects that use older frameworks
  • Removing unused architectures to extract an ipa from an archive
  • 为旧项目或使用旧框架的项目的设备部署需要上述旧版构建系统设置
  • 删除未使用的架构以从档案中提取 ipa

回答by Govani Dhruv Vijaykumar

Here is what works for me:

以下是对我有用的方法:

  1. Remove the app and profile from device
  2. Reinstall them again.
  1. 从设备中删除应用程序和配置文件
  2. 重新安装它们。

回答by Vittal Pai

For me, it's due to Dynamic Frameworks which I have added in the application. Initially, I have selected (Embed + Don't Sign) option for the dynamic frameworks.

对我来说,这是由于我在应用程序中添加了动态框架。最初,我为动态框架选择了(嵌入 + 不签名)选项。

Changing it to (Embed & Sign) for such frameworks resolved the issue for me.

对于此类框架,将其更改为 (Embed & Sign) 解决了我的问题。

enter image description here

在此处输入图片说明

回答by acoder

Use Automatically manage signing

使用自动管理签名

Solve this issue.

解决这个问题。

checked auto signing

检查自动签名

回答by m1sh0

I manage to fix this issue when first I clean:

我第一次清洁时设法解决了这个问题:

cmd + k
shift + cmd + k

and then I delete all the content of Deriving Data the path of the folder should be like this

然后我删除派生数据的所有内容文件夹的路径应该是这样的

/Users/youruser/Library/Developer/Xcode/DerivedData

Or you can check it in

或者你可以签入

Xcode -> Preferences -> Locations

回答by Michael Montalbano

"-402620395 Failure Reason: A valid provisioning profile for this executable was not found."

“-402620395 失败原因:找不到此可执行文件的有效配置文件。”

I had this issue as well and solved it:

我也有这个问题并解决了它:

This means that your provisioning profile is not set to development. You need to create a new provisioning profile for development, which is different than a profile set for distribution. Then, in signing and capabilities, in your app settings on xcode, choose your development profile if you want to install on your device. Don't worry about distributing with your dev profile, you must choose which profile you want to use when pushing to app store (its set to none and you need to switch it).

这意味着您的配置文件未设置为开发。您需要为开发创建一个新的配置文件,这与用于分发的配置文件集不同。然后,在签名和功能中,在 xcode 上的应用程序设置中,如果您想安装在您的设备上,请选择您的开发配置文件。不用担心与您的开发配置文件一起分发,您必须选择在推送到应用商店时要使用的配置文件(设置为无,您需要切换它)。

Another solution would be choosing automatically manage signing in settings, but that has defaults set when pushing to app store which you might not want.

另一种解决方案是选择自动管理登录设置,但在推送到您可能不想要的应用商店时设置了默认值。

回答by yoAlex5

Try to clean Provisioning Profiles[About]

尝试清洁Provisioning Profiles[关于]

Xcode -> Window -> Devices and Simulators 
-> Right click on your device -> Show Provisioning Profiles...
-> Select Provisioning Profile -> - Remove selected profiles

回答by Sahey

In my case the problem was occurred by empty framework references in pbxproj. After removing them the problem was fixed.

在我的情况下,问题是由 pbxproj 中的空框架引用引起的。删除它们后,问题就解决了。

enter image description here

在此处输入图片说明

回答by abed

I have the same issue and the problem was that I were using unpaid account and the total number of free development profiles was reached ,so you have to use paid account

我有同样的问题,问题是我使用的是未付费帐户并且达到了免费开发配置文件的总数,因此您必须使用付费帐户

detailes :

详情:

Failure Reason: The maximum number of apps for free development profiles has been reached

失败原因:已达到免费开发配置文件的最大应用程序数

回答by Stunner

I got this error when running a project that had a library under Embed Frameworkswhich had Code Sign on Copyunchecked. Check-marking this resolved this issue for me.

运行一个项目,有一个库下,当我得到这个错误Embed Frameworks其中有Code Sign on Copy听之任之。勾选这为我解决了这个问题。