xcode iPhone 调试:如何解决“无法获取进程任务”?

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

iPhone Debugging: How to resolve 'failed to get the task for process'?

xcodeprovisioningadhoc

提问by Massimo Cafaro

I have just added a provisioning profile to XCode (needed to support notifications and in app purchase), setup as needed the build configuration for ad hoc distribution, and tried to run the app on the device (I have done this several times in the past, without any problem).

我刚刚向 XCode 添加了一个配置文件(需要支持通知和应用程序购买),根据需要设置临时分发的构建配置,并尝试在设备上运行该应用程序(我过去曾多次这样做) ,没有任何问题)。

The app is installed, but it does not start. On the console, I see the following message:

该应用程序已安装,但未启动。在控制台上,我看到以下消息:

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

However, if I start the application on the device manually, it works as expected. I have recently installed the latest XCode 3.2 for Snow Leopard. Is this a known bug of this version of XCode or am I doing something wrong?

但是,如果我手动启动设备上的应用程序,它会按预期工作。我最近为雪豹安装了最新的 XCode 3.2。这是这个版本的 XCode 的已知错误还是我做错了什么?

EDIT: It works fine with release distribution using the development provisioning profile. I have checked again the ad hoc provisioning profile to make sure it includes the device I am using.

编辑:它适用于使用开发配置文件的发行版。我再次检查了临时配置文件以确保它包含我正在使用的设备。

采纳答案by fbrereto

I have had problems debugging binaries on the device via XCode when the app includes an Entitlements.plist file, which is not necessary to install onto the device for debugging. In general, then, I have included this file for release builds (where it is required for the App Store) and removed it for debugging (so I can debug the app from XCode). That may be your problem here.

当应用程序包含 Entitlements.plist 文件时,我在通过 XCode 在设备上调试二进制文件时遇到问题,无需安装到设备上进行调试。一般来说,我已经包含了这个文件用于发布版本(App Store 需要它)并删除它以进行调试(因此我可以从 XCode 调试应用程序)。那可能是你这里的问题。

Update: As of (at least) August 2010 (iPhone 4.1 SDK) the Entitlements.plist is no longer necessary to include in your application in many cases (e.g., distribution through the App Store.) See herefor more information on the cases when Entitlements.plist is required:

更新:从(至少)2010 年 8 月(iPhone 4.1 SDK)起,在许多情况下(例如,通过 App Store 分发)不再需要将 Entitlements.plist 包含在您的应用程序中。有关以下情况的更多信息,请参见此处Entitlements.plist 是必需的:

IMPORTANT: An Entitlements file is generally only needed when building for Ad Hoc Distribution or enabling Keychain data sharing. If neither of these is true, delete the entryin Code Signing Entitlements. (emphasis mine)

重要提示:通常仅在为 Ad Hoc Distribution 构建或启用 Keychain 数据共享时才需要权利文件。如果这些都不是真的,请删除代码签名权利中的条目。(强调我的)

回答by cdespinosa

The ad-hoc profile doesn't support debugging. You need to debug with a Development profile, and use the Ad-Hoc profile only for distributing non-debuggable copies.

临时配置文件不支持调试。您需要使用 Development 配置文件进行调试,并且仅将 Ad-Hoc 配置文件用于分发不可调试的副本。

回答by Aks

I Had the same issue, but resolved it by following simple following steps :

我遇到了同样的问题,但通过以下简单的步骤解决了它:

  1. Make sure you have selected debug rather than release.
  2. In Debug configurations, in project settings, you should have selected developer's profile & no need of specifying the entitlements plist.
  3. Also same setting are there under: Targets: , if not manuall change them to the above for the debug config. It will work.
  1. 确保您选择了调试而不是发布。
  2. 在调试配置中,在项目设置中,您应该选择了开发人员的配置文件,无需指定权利 plist。
  3. 同样的设置也有:目标:,如果没有手动将它们更改为上面的调试配置。它会起作用。

All the best.

祝一切顺利。

回答by Atma

This took me a while to figure out.

这花了我一段时间才弄明白。

If you are using a distribution / ad hoc/ profile you cannot test it through xcode. You will get the error: The program being debugged is not being run.

如果您使用的是发行版/临时/配置文件,则无法通过 xcode 对其进行测试。您将收到错误消息:正在调试的程序未在运行。

You can build the app, go to the products folder in your app in xcode, click on the file with your project name and choose reveal in finder. You can drag this app into into iTunes and sync and that point you can test your app on your device.

您可以构建应用程序,在 xcode 中转到应用程序中的产品文件夹,单击具有项目名称的文件,然后选择在 finder 中显示。您可以将此应用程序拖入 iTunes 并同步,然后您就可以在您的设备上测试您的应用程序。

回答by Varun Bhatia

If you are getting such error, the only reason could be you using a Distribution profile rather than a development profile in Xcode or a missing Entitlement property. If you are not using the Entitlements.plist, then the only possible error could be the app is getting packaged with a distribution profile. You could verify this confirming the build logs. To change this, go to Build Setting of the project and verify Code Signing Entity setting. For debugging to work, this setting should be a developer profile for the configuration that you are currently using.

如果您收到此类错误,唯一的原因可能是您在 Xcode 中使用了分发配置文件而不是开发配置文件或缺少权利属性。如果您没有使用 Entitlements.plist,那么唯一可能的错误可能是应用程序被打包到分发配置文件中。您可以验证这一点以确认构建日志。要更改此设置,请转到项目的构建设置并验证代码签名实体设置。为了调试工作,此设置应该是您当前使用的配置的开发人员配置文件。

https://developer.apple.com/library/ios/#qa/qa1682/_index.html

https://developer.apple.com/library/ios/#qa/qa1682/_index.html

For instant results, delete all mobile provisioning profiles from xcode and install the developer profile that you intend to use.

为获得即时结果,请从 xcode 中删除所有移动配置文件并安装您打算使用的开发人员配置文件。

回答by Kjuly

Almost 2hrs on this issue! And finally I solved it by replacing the

在这个问题上将近 2 小时!最后我通过更换

iPhone Developer

iPhone 开发者

to

iPhone Developer: My Dev Account Name

iPhone 开发者:我的开发者账户名

for Debug's CODE_SIGN_IDENTITY:

对于调试CODE_SIGN_IDENTITY

  1. Select Project Target
  2. Build Settings
  3. Search by "code sign"
  4. Modify CODE_SIGN_IDENTITYsection's Debug row with "iPhone Developer: My Dev Account Name", not just "iPhone Developer".
  1. 选择项目目标
  2. 构建设置
  3. “代码符号”搜索
  4. 使用"iPhone Developer: My Dev Account Name"修改CODE_SIGN_IDENTITY部分的 Debug 行,而不仅仅是"iPhone Developer"

I've no idea why it works, but it does! At least for me!

我不知道为什么它有效,但确实如此!至少对于我来说!



Environment: Xcode 5.0 (5A1412).

环境:Xcode 5.0 (5A1412)。

回答by user1770342

Check ur code signing section.make sure that the code signing is iPhoneDeveloper code signe

检查你的代码签名部分。确保代码签名是 iPhoneDeveloper 代码签名

回答by Kai

Open Entitlements.plist and set the boolean value get-task-allow to YES - the debugger can attach now!

打开 Entitlements.plist 并将布尔值 get-task-allow 设置为 YES - 调试器现在可以附加了!

回答by Arunabh Das

Go to Edit Schemes and under Run -> Info -> Build Configuration, change from Ad-Hoc to Debug. Click OK to save.

转到 Edit Schemes 并在 Run -> Info -> Build Configuration 下,从 Ad-Hoc 更改为 Debug。单击确定保存。

回答by bugle

I received this error when I tried to launch app from Xcode as I figured I had selected distribution profile only. Build was successful so I created .ipa file. I used testflightapp.com to run the app. You can use iTunes as well.

当我尝试从 Xcode 启动应用程序时收到此错误,因为我认为我只选择了分发配置文件。构建成功,所以我创建了 .ipa 文件。我使用 testflightapp.com 来运行该应用程序。您也可以使用 iTunes。