ios Xcode 将在模拟器上运行应用程序但不在设备上

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

Xcode will run app on simulator but not on device

iosxcodedebuggingxcode4

提问by Pterie Daktyl

I receive the following error when trying to run the app on my device.

尝试在我的设备上运行该应用程序时收到以下错误。

error: failed to launch '/Users/michael/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/Word Processor.app/Word Processor' -- No such file or directory (/Users/michael/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/Word Processor.app/Word Processor)

The app runs fine in the simulator. When I try to debug on the device, it appears to copy the app (I can see the icon), but then stalls with the above message. Xcode says it is running the app on my iPod, but nothing is happening on my iPod.

该应用程序在模拟器中运行良好。当我尝试在设备上调试时,它似乎复制了应用程序(我可以看到图标),但随后因上述消息而停止。Xcode 说它正在我的 iPod 上运行该应用程序,但我的 iPod 上没有任何反应。

When I click on the app, the app appears to launch, but seems to be missing resources. Other projects of mine work properly. What setting do I need to change to make this work properly.? Looking at the error message, it seems to be looking in my mac for the app. But this doesn't make sense since I am trying to run it on my 4th gen iPod touch. I am using Xcode 4.3.1 and iOS 5.1

当我单击该应用程序时,该应用程序似乎已启动,但似乎缺少资源。我的其他项目工作正常。我需要更改什么设置才能使其正常工作。?查看错误消息,它似乎在我的 mac 中寻找该应用程序。但这没有意义,因为我试图在我的第 4 代 iPod touch 上运行它。我使用的是 Xcode 4.3.1 和 iOS 5.1

回答by NathanChristie

With Mountain Lion and the latest version of Xcode (4.4.4F250), none of the suggestions in this thread worked directly (clean, clean project, remove derived data folder, etc). This sequence did. From DhilipSiva:

使用 Mountain Lion 和最新版本的 Xcode (4.4.4F250),该线程中的任何建议都没有直接起作用(清理、清理项目、删除派生数据文件夹等)。这个序列做到了。来自DhilipSiva

  1. Disconnect your device
  2. Delete the app from your device
  3. Quit Xcode (Don't just simply close the window, quit it)
  4. Delete derived data folder rm -fr ~/Library/Developer/Xcode/DerivedData(console)
  5. Start Xcode,connect device & run the project
  1. 断开您的设备
  2. 从您的设备中删除该应用程序
  3. 退出 Xcode(不要只是简单地关闭窗口,退出它)
  4. 删除派生数据文件夹rm -fr ~/Library/Developer/Xcode/DerivedData(控制台)
  5. 启动Xcode,连接设备并运行项目

回答by Chronos

I solve this by going to Targets-> Info -> Required Device capabilities and delete the option with armv7.

我通过转到目标-> 信息-> 所需的设备功能并使用 armv7 删除该选项来解决此问题。

Hope this helps!

希望这可以帮助!

回答by Matthew Frederick

This is a recurring problem that many developers are having with the current version of Xcode. The temporary workaround has been consistently deleting the DerivedData folder.

这是许多开发人员在使用当前版本的 Xcode 时经常遇到的问题。临时解决方法一直是删除 DerivedData 文件夹。

You can add doing it to a build script or even make it a cron job:

您可以将其添加到构建脚本中,甚至可以将其设为 cron 作业:

rm -rf ~/Library/Developer/Xcode/DerivedData

rm -rf ~/Library/Developer/Xcode/DerivedData

Sad, but true.

悲伤,但真实。

回答by parametr

For me restarting of Xcode, cleaning DerivedData and restaring device wasn't enough in most cases, until I had figured out that iTunes was also running, and after quitting iTunes everything worked fine!

对于我重新启动 Xcode,在大多数情况下清理 DerivedData 和重新启动设备是不够的,直到我发现 iTunes 也在运行,并且在退出 iTunes 后一切正常!

So my steps now are simple:

所以我现在的步骤很简单:

1. Quit Xcode.
2. If iTunes is running, quit iTunes.
3. Reopen project.

1. 退出 Xcode。
2. 如果 iTunes 正在运行,请退出 iTunes。
3. 重新打开项目。

No need to remove app from the device, clean project or restart/disconnect device. I think that's because Xcode and iTunes use some common libraries (as you know, Xcode Installer always asks to quit iTunes on installing iOS SDK).

无需从设备中删除应用程序、清理项目或重启/断开设备。我认为这是因为 Xcode 和 iTunes 使用一些公共库(如您所知,Xcode Installer 在安装 iOS SDK 时总是要求退出 iTunes)。

回答by Peter Lakatos

I also had this problem after changing from a lower XCode and iOS version to the current XCode and iOS version.

从较低的 XCode 和 iOS 版本更改为当前的 XCode 和 iOS 版本后,我也遇到了这个问题。

I fixed this problem by changing th iOS Depolyment Target to a lower version, since my Device is not updated to the latest iOS yet. You can do this by clicking the project inside the Info tab.

我通过将 iOS Depolyment Target 更改为较低版本来解决此问题,因为我的设备尚未更新到最新的 iOS。您可以通过单击“信息”选项卡内的项目来执行此操作。

回答by BrettS

Have you looked at the Developer Certs and Distribution Certs if you have. When running in debug mode from Xcode your will need your app assigned with the developer cert and not the distribution cert. The distribution certs do not allow for debugging.

如果您有,您是否查看过开发人员证书和分发证书。当从 Xcode 以调试模式运行时,您需要为您的应用程序分配开发人员证书而不是分发证书。分发证书不允许调试。

回答by pgb

This error will manifest whenever the device capabilities described in the Info.plist do not match those of the device.

每当 Info.plist 中描述的设备功能与设备的功能不匹配时,就会出现此错误。

In my case, I was requesting GPS support and location-services support and trying to test on an iPod touch.

就我而言,我请求 GPS 支持和位置服务支持,并尝试在 iPod touch 上进行测试。

回答by Bijoy Thangaraj

I struggled with this problem for 2 days and went through all the posts, tried all the options including, restarting Xcode, device, deleting DerivedData folder etc.

我在这个问题上挣扎了 2 天,浏览了所有帖子,尝试了所有选项,包括重新启动 Xcode、设备、删除 DerivedData 文件夹等。

Finally, the problem was with the Info.plist file. In my case, I had improper icon paths in the Info.plist file. I suggest you to archive the application and then validate it to get the exact problem in you case. Only when I did that, I was able to find the issue.

最后,问题出在 Info.plist 文件上。就我而言,我在 Info.plist 文件中有不正确的图标路径。我建议您将应用程序存档,然后对其进行验证以解决您遇到的确切问题。只有当我这样做时,我才能找到问题所在。

回答by Wayne Shelley

Removed armv6 support and it started working again

删除了 armv6 支持并重新开始工作

回答by Juan Haladjian

I solved this problem many times with DhilipSiva's solution. However, it may not work sometimes. If that is the case, consider deleting and re-adding the target.

我用DhilipSiva的解决方案多次解决了这个问题。但是,有时它可能不起作用。如果是这种情况,请考虑删除并重新添加目标。