ios Xcode 无法获取进程 XXX 的任务。我该如何解决这个问题?(iPhone SDK 4.0)

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

Xcode fails to get the task for process XXX. How do I solve this? (iPhone SDK 4.0)

xcodeios

提问by confusedKid

I have the following error when I try to run a new project on my ipod:

当我尝试在 ipod 上运行新项目时出现以下错误:

Error launching remote program: failed to get the task for process 312.
The program being debugged is not being run.

I've read about Entitlements.plist, and I've tried to add the get-task-allow, but then it doesn't let me compile because of a code signing error. I only have a development provisioning profile, so it's not the same as the people who were trying to debug the distribution build (I'm also in the debug build, so that isn't a problem).

我已经阅读了 Entitlements.plist,并尝试添加 get-task-allow,但由于代码签名错误,它不允许我进行编译。我只有一个开发配置文件,所以它与试图调试分发版本的人不同(我也在调试版本中,所以这不是问题)。

Old projects build and run fine on the ipod, just new projects.

旧项目在 ipod 上构建和运行良好,只是新项目。

I've tried restarting both xcode and my ipod, but it doesn't help.

我试过重新启动 xcode 和 ipod,但没有帮助。

I have no more ideas on how to build/run new projects on xcode, so any help is much appreciated!

我对如何在 xcode 上构建/运行新项目没有更多想法,因此非常感谢任何帮助!

Oh, and I'm using an iPod 3G with iOS 4.0.1. Xcode is 3.2.3 (64-bit).

哦,我正在使用装有 iOS 4.0.1 的 iPod 3G。Xcode 是 3.2.3(64 位)。

回答by confusedKid

It turns out that using a different provisioning profile (one with a wildcard rather than one without) solved this issue.

事实证明,使用不同的配置文件(一个带有通配符而不是一个没有)解决了这个问题。

The key point is to use a Developer profile rather than a Distribution profile.

关键是使用开发人员配置文件而不是分发配置文件。

回答by Daniel O

Check that you're doing signing using a development provisioning profile, not a distribution one.

检查您是否正在使用开发配置文件而不是分发文件进行签名。

回答by Omer Waqas Khan

This error happens when you have set Distribution Provisioning profile in code signing. Change it to Developer Provisioning Profile, then it will work. Worked for me for Xcode SDK 4.5.

当您在代码签名中设置分发供应配置文件时,会发生此错误。将其更改为 Developer Provisioning Profile,然后它将起作用。为我工作过 Xcode SDK 4.5。

回答by Raptor

There is also a case that your error would happen.

还有一种情况是你的错误会发生。

If an app with same Bundle Identifier is launched at background ( probably an App Store version ), Xcode debugger will not know which App it should attach to. To solve it, remove/uninstall the App Store version, and click Runin Xcode again.

如果在后台启动具有相同捆绑标识符的应用程序(可能是 App Store 版本),Xcode 调试器将不知道它应该附加到哪个应用程序。要解决它,请删除/卸载 App Store 版本,然后Run再次单击Xcode。

The same story can apply if you once build the app with a bundle id then you changed the project bundle id and still kept both app versions. make sure you remove the old one.

如果您曾经使用 bundle id 构建应用程序,然后更改项目 bundle id 并仍然保留两个应用程序版本,那么同样的故事也适用。确保您删除旧的。

回答by user3841460

Go to the Apple Developer Center and make sure that your developer certificate has not expired. Mine had expired so I renewed it and then went back into Xcode (5.1.1) and under accounts preferences I viewed the details of my apple account and hit the little refresh button at the bottom. My iOS development signing identity showed up and I was back in business.

转到 Apple 开发人员中心并确保您的开发人员证书未过期。我的已经过期,所以我更新了它,然后回到 Xcode (5.1.1),在帐户首选项下,我查看了我的苹果帐户的详细信息,然后点击了底部的小刷新按钮。我的 iOS 开发签名身份出现了,我又重新开始工作了。

回答by Bruce Cichowlas

If your certificates are not quite right or have become not quite right, this problem can start to happen and you can go round and round playing with provision and entitlement files to no effect. (In nearly all cases, you don't need an entitlement file.)

如果您的证书不太正确或变得不太正确,则此问题可能会开始发生,您可以反复使用配置文件和授权文件,但没有任何效果。(几乎在所有情况下,您都不需要权利文件。)

I'm talking here about debugging on a tethered device in "debug" mode, not any sort of "release" mode.

我在这里谈论的是在“调试”模式下在系留设备上进行调试,而不是任何类型的“发布”模式。

Here's how I finally determined this was the problem and fixed it:

这是我最终确定这是问题并修复它的方法:

1) Try to create the simplest Xcode project possible and in Target...General set it up for your "Team". (If you find this impossible to do, that already is a sign of this sort of problem.)

1) 尝试尽可能创建最简单的 Xcode 项目,并在 Target...General 中为您的“团队”进行设置。(如果你发现这不可能做到,那已经是这类问题的征兆。)

2) Tether your device and try to run on it. Normally, this would go smoothly, but if the opening screen appears on your device for a second or two and then the app crashes and Xcode says it can not attach to some positive task id, then you may have the sort of problem I had.

2) 绑定您的设备并尝试在其上运行。通常情况下,这会顺利进行,但是如果打开屏幕在您的设备上出现一两秒钟,然后应用程序崩溃并且 Xcode 说它无法附加到某些积极的任务 ID,那么您可能遇到了我遇到的那种问题。

3) So I then went to another Mac with Xcode and did the same thing, letting Xcode 5 automatically get the needed credentials. (I'm using a "wild card" * app id for all of this.) In my case, much to my surprise the simple app I created on the new Mac ran on the tethered device just fine keeping up its opening screen indefinitely. What a relief. So I then went to keychain access on the new machine, exported all of the relevant keys into one file and then exported the relevant certificated to a .p12 file. I also made a copy of the new working project to take back to the first Mac.

3) 然后我用 Xcode 去了另一台 Mac 并做了同样的事情,让 Xcode 5 自动获取所需的凭据。(我对所有这些都使用“通配符”* 应用程序 ID。)就我而言,令我惊讶的是,我在新 Mac 上创建的简单应用程序可以在系留设备上运行,并且可以无限期地保持其打开屏幕。终于解脱了。所以我然后去新机器上的钥匙串访问,将所有相关的密钥导出到一个文件中,然后将相关的证书导出到一个 .p12 文件。我还复制了新的工作项目以带回第一台 Mac。

4) Back at the first Mac using the app for the second Mac, it had trouble with the Team ID when I looked at the Target...General screen. Your symptoms might be different, but the point is I couldn't rebuild the app from the second Mac on the first Mac.

4) 回到第一台 Mac,在第二台 Mac 上使用该应用程序,当我查看 Target...General 屏幕时,Team ID 出现问题。您的症状可能有所不同,但关键是我无法在第一台 Mac 上从第二台 Mac 重建应用程序。

5) So I then opened up Keychain Access (possibly not necessary) and double-clicked on the files I brought over, first the one with the keys and then the one with the certificate, providing the p12 password when requested. (Some of this may not actually be necessary, but I'm not sure which and I am describing what worked for me.)

5) 然后我打开 Keychain Access(可能没有必要)并双击我带来的文件,首先是带有密钥的文件,然后是带有证书的文件,并在需要时提供 p12 密码。(其中一些实际上可能不是必需的,但我不确定哪个并且我正在描述对我有用的内容。)

6) I did step 4 again and this time it worked fine! I then found that the other programs that were giving me the "failed to get task" problem now worked fine, too. I just wish I could get back all the time I lost before I tried the process described here.

6)我再次执行了第 4 步,这次效果很好!然后我发现其他给我“无法获取任务”问题的程序现在也可以正常工作。我只是希望在尝试这里描述的过程之前,我能把我失去的所有时间都找回来。

Conclusion, something was wrong or had become wrong with the certificates or the keys on the first Mac. It was subtle enough that I could still do builds, make ad hoc releases, etc. but I could not run on a tethered device. Though I don't think it is a factor, I was using a corporate developer account and this Mac was set up to do development for several other developer accounts (and these did not display the problem).

结论是,第一台 Mac 上的证书或密钥出了问题或出现了问题。这很微妙,我仍然可以进行构建、制作临时版本等,但我无法在系留设备上运行。虽然我不认为这是一个因素,但我使用的是公司开发者帐户,并且这台 Mac 被设置为为其他几个开发者帐户进行开发(这些没有显示问题)。

回答by meaning-matters

After Xcode 5.0 tried and failed (it hung) to update certificates, ... which it suggested me to do. All I did then:

在 Xcode 5.0 尝试并失败(挂起)更新证书之后,......它建议我这样做。我当时所做的一切:

  • Restart Xcode 5.0
  • Open Window > Organizer
  • Select Devices at the top
  • Select my device (which had a green bullet)
  • Click the (+) Add to Member Center at the bottom and follow the few simple steps
  • 重启 Xcode 5.0
  • 打开窗口 > 管理器
  • 选择顶部的设备
  • 选择我的设备(带有绿色项目符号)
  • 单击底部的 (+) 添加到会员中心并按照几个简单的步骤操作

回答by NSCoder

Removing distribution profiles from device in Organizer solved this issue for me

从管理设备中删除分布状况解决了这个问题对我来说

回答by Yano

1.Run the Application using development certificates in both debug and release area in code signing identity.

1.运行使用开发证书在代码签名身份调试和发行领域的应用。

or

或者

2.Use the development certificate in debug area and distribution certificate in release area.

2.在调试区使用开发证书,在发布区使用分发证书。