ios Xcode 突然停止在硬件上运行项目:“无法启动 xxx.app: .. No such file..”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11456312/
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
Xcode suddenly stopped running project on hardware: "Could not launch xxx.app: .. No such file.."
提问by Gruntcakes
Xcode has stopped being able to run my app, it started directly after I deleted it from the device and attempted to re-install by rerunning it in Xcode (something I've done hundreds of times before).
Xcode 已停止运行我的应用程序,它在我从设备中删除它后直接启动,并尝试通过在 Xcode 中重新运行它来重新安装(我以前做过数百次)。
It says
它说
"Could not launch XXX.app"
"No such file or directory (/Users/Mylaptop/Library/Developer/Xcode/DerivedData/MyApp-ekxcbebfpzkahtfkujyqkcwprzia/Build/Products/Debug-iphoneos/MyApps.app/MyApp)."
“无法启动 XXX.app”
“没有这样的文件或目录(/Users/Mylaptop/Library/Developer/Xcode/DerivedData/MyApp-ekxcbebfpzkahtfkujyqkcwprzia/Build/Products/Debug-iphoneos/MyApps.app/MyApp)。”
I've rebooted the phone, relaunched Xcode, cleaned everything, rebuilt everything. This error message won't go away.
我已经重新启动手机,重新启动的Xcode,清除一切,重建一切。此错误消息不会消失。
This is with Xcode 4.5 which I've been using since it became available, if I revert to 4.3.2 then Xcode says "Finished running app" but it doesn't actually do anything - the app is neither installed nor run.
这是 Xcode 4.5,自从它可用以来,我一直在使用它,如果我恢复到 4.3.2,那么 Xcode 会说“已完成运行的应用程序”,但它实际上并没有做任何事情 - 该应用程序既没有安装也没有运行。
I'm completely stuck - unable to run anything on the device anymore.
我完全卡住了 - 无法再在设备上运行任何东西。
Any suggestions?
有什么建议?
回答by Sudhakar
That is really annoying. This error happens in a number of different situations. Sometimes restarting the Xcode, fixes the problem. If not, follow these steps:
这真的很烦人。此错误发生在许多不同的情况下。有时重新启动 Xcode,即可解决问题。如果没有,请按照以下步骤操作:
Disconnect your device.
断开您的设备。
Delete the app from your device.
从您的设备中删除该应用程序。
Quit Xcode (Do not just simply close the window, quit it)
退出 Xcode(不要只是简单地关闭窗口,退出它)
Delete derived data folder (~/Library/Developer/Xcode/DerivedData/-gbrvhlvwmpiobxdujegtghggrffp
- or something like that)
删除派生数据文件夹(~/Library/Developer/Xcode/DerivedData/-gbrvhlvwmpiobxdujegtghggrffp
- 或类似的东西)
Now start Xcode once again, connect device and run the project. It should work fine.
现在再次启动 Xcode,连接设备并运行项目。它应该可以正常工作。
from DhilipSiva blog
来自 DhilipSiva博客
回答by Almog C
Try deleting "Required device capabilities" in the -Info.plist file.
尝试删除 -Info.plist 文件中的“必需的设备功能”。
You can't require armv7 on a 3G, and you can't require armv6 on any newer device, so just delete this attribute entirely.
您不能在 3G 上要求 armv7,也不能在任何较新的设备上要求 armv6,因此只需完全删除此属性即可。
回答by wihing
I found the answer. The iOS deployment target's version was not the same as my device's OS version.
我找到了答案。iOS 部署目标的版本与我设备的操作系统版本不同。
回答by Joris van Liempd iDeveloper
First tried some of the above with info.plists and deleting derived data, clean, etc.
首先用 info.plist 尝试了上面的一些并删除派生数据,清理等。
My solution: quit XCode, reopen project. Go to derived data in Finder. Deleted data for all projects (was all trashable, but I would try deleting your troubled projectdata first). And then it worked again. Deleting derived data from XCode didn't work.
我的解决方案:退出 XCode,重新打开项目。转到 Finder 中的派生数据。删除了所有项目的数据(都是垃圾,但我会先尝试删除您有问题的项目数据)。然后它又起作用了。从 XCode 删除派生数据不起作用。
回答by KeithL
The following resolved my problem... my app worked for me in debug/release, then I built a few ad-hoc archives and debug/release builds stopped working.
以下解决了我的问题......我的应用程序在调试/发布中为我工作,然后我构建了一些临时存档并且调试/发布版本停止工作。
Symptoms:
症状:
- invalid entitlements errors when launching from Xcode to device (play with entitlements...)
- immediate abort with no error (finished running ) when running simulator
- could not launch ... directory blabla.../build/product/debug-iphoneos/... not found when launching from Xcode to device.
- 从 Xcode 启动到设备时无效的权利错误(玩权利......)
- 运行模拟器时立即中止且没有错误(已完成运行)
- 无法启动...目录 blabla.../build/product/debug-iphoneos/... 从 Xcode 启动到设备时找不到。
Eventually after trying to benefit from everyone else's pain I found in Targets [AppName]:
最终在尝试从其他人的痛苦中受益后,我在 Targets [AppName] 中发现:
Build Settings
Build Locations
Build Products Path build
should be
应该
Build Products Path build/Products
No idea how this got set incorrectly. This must be hard-coded somewhere in Xcode/Springboard because 'Products' appears in both Xcode and in the Device console. This is Xcode 4.5.1.
不知道这是如何设置错误的。这必须在 Xcode/Springboard 中的某处进行硬编码,因为“产品”同时出现在 Xcode 和设备控制台中。这是 Xcode 4.5.1。
回答by Scott Driscoll
I solved this problem by
我解决了这个问题
renaming a directory above my XCode project
重命名我的 XCode 项目上方的目录
Changing the name of the project in XCode
fixed it for me.
更改项目名称XCode
为我修复了它。
In
XCode
, under the Project Navigator, click the project name, and it should let you rename it just like a file in Finder. Deleting derived data did not help.
在 中
XCode
,在 Project Navigator 下,单击项目名称,它应该可以让您像 Finder 中的文件一样重命名它。删除派生数据没有帮助。
回答by ecreif
I built my XCode Project with CMake and somehow it (or my stupid self) deleted or emptied the property "Executable file" in the info.plist. I set it back to ${EXECUTABLE_NAME} and it worked again.
我用 CMake 构建了我的 XCode 项目,不知何故它(或我愚蠢的自己)删除或清空了 info.plist 中的属性“可执行文件”。我将它重新设置为 ${EXECUTABLE_NAME} 并且它再次工作。
Took me really alot of time working through all the suggestions and fixes until I finally found that problem.
我花了很多时间来研究所有建议和修复,直到我最终发现了这个问题。
Hope this will help some one struggling with the same problem
希望这会帮助一些在同样问题上挣扎的人
Edit:
编辑:
It was in some way CMake messing up my plist file. I created my own Info.plist and used it the following way:
在某种程度上,CMake 弄乱了我的 plist 文件。我创建了自己的 Info.plist 并按以下方式使用它:
SET_TARGET_PROPERTIES( MyApp PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_LIST_DIR}/MyApp.plist )
Inside my plist I had this entry:
在我的 plist 中,我有这个条目:
<key>CFBundleExecutable</key> <string>${EXECUTABLE_NAME}</string>
Unfortunately CMake still seems to parse that file and replaced ${EXECUTABLE_NAME} with an empty string since its the CMake variable syntax. My quick work around is the following:
不幸的是,CMake 似乎仍然解析该文件并将 ${EXECUTABLE_NAME} 替换为空字符串,因为它是 CMake 变量语法。我的快速解决方法如下:
SET( EXECUTABLE_NAME "${EXECUTABLE_NAME}" )
Now it works like a charm.
现在它就像一个魅力。
I am probably alone with exactly this problem, but who knows.
我可能只有这个问题,但谁知道呢。
回答by Unfalkster
I had the same problem, but in my case I had a wrong requirement in my info.plist (require gyroscope for an iPhone 3Gs)
我遇到了同样的问题,但就我而言,我的 info.plist 中有一个错误的要求(iPhone 3G 需要陀螺仪)
回答by iSaalis
I tried to run my project on a different system other than that on which it was developed. I was getting “Could not launch xxx.app: .. No such file..”.
我尝试在与开发项目不同的系统上运行我的项目。我收到“无法启动 xxx.app:.. 没有这样的文件..”。
Removed the app from the device and then deleted the derived data from organizer in xcode for the app. Organizer-->Projects-->Derived DAta-->Delete
从设备中删除应用程序,然后从应用程序的 xcode 管理器中删除派生数据。组织者-->项目-->派生数据-->删除
My problem was resolved.
我的问题解决了。
回答by Jim Huang
You need to set the deployment target LOWER than your device's version
您需要将部署目标设置为低于您设备的版本