xcode 在 iPhone 上完成运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10337100/
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
Finished Running on iPhone
提问by Lolloz89
I am trying to test my app on an iPhone 4S. When I build and run from Xcode, the project is successfully compiled but after that Xcode says:
我正在尝试在 iPhone 4S 上测试我的应用程序。当我从 Xcode 构建和运行时,该项目已成功编译,但之后 Xcode 说:
Finished running MyApp.app on MyiPhone
完成在 MyiPhone 上运行 MyApp.app
The app perfectly work on the simulator and the provisioning profile works correctly (I tried to load an empty app and it works).
该应用程序在模拟器上完美运行,并且配置文件正常运行(我尝试加载一个空应用程序并且它可以正常工作)。
If I try to manually load the app I get this message:
如果我尝试手动加载应用程序,我会收到以下消息:
The Info.plist for application at /Users/*/Documents/App/AppName/DerivedData/AppName/Build/Products/Release-iphoneos/AppName.app specifies a CFBundleExecutable of AppName, which does not exist.
位于/Users/ */Documents/App/AppName/DerivedData/AppName/Build/Products/Release-iphoneos/AppName.app 的应用程序的Info.plist指定了一个不存在的AppName 的CFBundleExecutable。
Where is the problem?
问题出在哪儿?
回答by Nils Munch
The connection that XCode creates with the device is rather fragile, and can easily be corrupted if anything goes amiss in the debugging test, most commonly if the developer stops a build, while it is being moved to the device.
XCode 与设备建立的连接相当脆弱,如果在调试测试中出现任何问题,很容易被破坏,最常见的是开发人员在将构建移动到设备时停止构建。
I have a routine of things I go through, when this occurs. If one doesn't work, I go further down the list.
当发生这种情况时,我有我经历的事情的例行程序。如果一个不起作用,我会在列表中更进一步。
Check your signing certificates: This error can occur if you mess around with the certificates too much. Make sure your current scheme uses the Debug signing when making a debug build, and check in your application settings if the current debug signing certificate is a debug certificate. (Not AppStore, AdHoc or Enterprise).
Reestablish connection with the device: Look under devices in your Organizer. Check if the device you are using is present and marked with a green bullet. If orange or grey, reconnect the device with the USB. For precaution, wait a couple of seconds from taking the cable out before you insert it. It should make no difference if you eject the cable from your mac, or the part connecting your iDevice.
Reactivate development on the iDevice: Being unaware why this happends, some devices revert to a non-development stage from time to time. Clicking the "Enable development" under Organizer > Devices seems to clear this off.
Flushing XCode device connections: Something that often is needed, you can simply shut down XCode (and to be safe, close the iPhone simulator as well) and start it up anew. Deleting the debug application present on the iDevice is also a good idea.
Restart your iDevice: Tedious as it might seem, restarting your iDevice is sometimes needed, since the pipe held on the device might be corrupted.
Restarting your developer machine: If everything else fails, a restart of your mac is often required. I have never experienced this error without having it fixed by now.
检查您的签名证书:如果您过多地使用证书,可能会发生此错误。确保您的当前方案在进行调试构建时使用调试签名,如果当前调试签名证书是调试证书,请检查您的应用程序设置。(不是 AppStore、AdHoc 或 Enterprise)。
重新建立与设备的连接:查看管理器中的设备。检查您使用的设备是否存在并标有绿色项目符号。如果为橙色或灰色,请使用 USB 重新连接设备。为预防起见,在将电缆拔出之前,请等待几秒钟。如果您从 Mac 或连接 iDevice 的部分中取出电缆,应该没有区别。
重新激活 iDevice 上的开发:由于不知道为什么会发生这种情况,一些设备会不时恢复到非开发阶段。单击“管理器”>“设备”下的“启用开发”似乎可以将其清除。
刷新 XCode 设备连接:经常需要的东西,您可以简单地关闭 XCode(为了安全起见,也关闭 iPhone 模拟器)并重新启动它。删除 iDevice 上的调试应用程序也是一个好主意。
重新启动您的 iDevice:虽然看起来很乏味,但有时需要重新启动您的 iDevice,因为设备上的管道可能已损坏。
重新启动您的开发者机器:如果其他一切都失败了,通常需要重新启动您的 mac。我从来没有遇到过这个错误,现在还没有修复它。
I hope this checklist will help you through.
我希望这份清单能帮助你度过难关。
回答by Ali
Try cleaning the project.
SHIFT+CMD+K
尝试清理项目。
SHIFT+CMD+K
回答by Nupur Sharma
Found the same bug in XCode 9 while running the project on iPhone 5s. Clean the project and it will work.
在 iPhone 5s 上运行该项目时,在 XCode 9 中发现了相同的错误。清理项目,它将起作用。
回答by Shadros
- Clean.
- Build.
- Run.
- 干净的。
- 建造。
- 跑。
It's work for me.
这对我有用。
回答by rakeshNS
I had similar issue. When I run program on iPad2 it compiles and installs app on device, wait for some time, and display an alert. Then I followed steps below
我有类似的问题。当我在 iPad2 上运行程序时,它会编译并在设备上安装应用程序,等待一段时间并显示警报。然后我按照下面的步骤
1) Removed that application from device.
1) 从设备中删除了该应用程序。
2) Disconnected iPad and tried again.
2) 断开 iPad 并重试。
Then it successfully run in device. If this not resolved your issue, do
然后它在设备中成功运行。如果这不能解决您的问题,请执行
Rename your application to some thing else and try to run. It will run. Lastly you can make an "ipa" file with Ad Hod distribution and can test on device.
将您的应用程序重命名为其他名称并尝试运行。它会运行。最后,您可以使用 Ad Hod 分发版制作“ipa”文件,并可以在设备上进行测试。
回答by unexpectedvalue
Looks like you are trying to run a release product on the device. You are probably signing it with production key. Run it as debug.
看起来您正在尝试在设备上运行发布产品。您可能正在使用生产密钥对其进行签名。作为调试运行它。
回答by Lvsti
Maybe I'm totally off with this guess but the last time I got the same message was when I had some required hardware capabilities set in the Info.plist which the target device didn't comply with. (E.g. requiring a camera and trying to run the app on an iPad1.)
也许我完全不同意这个猜测,但最后一次我收到相同的消息是当我在 Info.plist 中设置了一些目标设备不符合的必需硬件功能时。(例如,需要摄像头并尝试在 iPad1 上运行该应用程序。)
回答by ObjectiveLee
I've just finished chasing down a similar problem.
我刚刚完成了对类似问题的追查。
An app that worked on the device (iPad 1) and on the simulator stopped loading on the iPad but continued to function as before on the simulator. When "run" with the device as target, it compiles and then goes immediately to "Finished Running...".
在设备 (iPad 1) 和模拟器上运行的应用程序停止在 iPad 上加载,但在模拟器上继续像以前一样运行。当以设备为目标“运行”时,它会编译,然后立即进入“已完成运行...”。
I did all the usual bits - removed the app from the device, ran Product/Clean, removed derived data, shut computer and device down cold, but with no luck. Other development apps loaded and ran fine.
我做了所有常见的工作 - 从设备上删除应用程序,运行产品/清理,删除派生数据,关闭计算机和设备冷,但没有运气。其他开发应用程序加载并运行良好。
This app uses GameKit. When I removed the gameKit requirement from Info.plist, the app loaded and ran correctly on the device again - including the GameKit functionality (no kidding). When I added gameKit back in, it failed again. When I added the gameKit requirement to other apps, they failed to load to the device as well. It appears that something has happened to the gameKit setting on the device, although gameKit is there and functions as always. I'm suspicious that this one has to do with the state of the sandbox.
此应用程序使用 GameKit。当我从 Info.plist 中删除 gameKit 要求时,应用程序再次加载并在设备上正确运行 - 包括 GameKit 功能(不开玩笑)。当我重新添加 gameKit 时,它再次失败。当我将 gameKit 要求添加到其他应用程序时,它们也无法加载到设备上。设备上的 gameKit 设置似乎发生了一些问题,尽管 gameKit 在那里并且一如既往地运行。我怀疑这与沙箱的状态有关。
I've got to make a few changes to get the app running on the iPhone and I'll test that as well. I'll repost if I sort it out.
我必须进行一些更改才能让应用程序在 iPhone 上运行,我也会对此进行测试。如果我解决了,我会重新发布。
回答by Claude COULOMBE
Si it seems that XCode build, ran and finished but the app failed to be deployed and was not even copied to the device.
Si 似乎 XCode 构建、运行和完成,但应用程序部署失败,甚至没有复制到设备。
In fact, there should be something in the XCode project that is broken. This is easily corrupted. The best move is to build a new project from scratch. Don't forget to add armv6 support if needed.
其实应该是XCode项目里面有什么东西坏了。这很容易损坏。最好的做法是从头开始构建一个新项目。如果需要,不要忘记添加 armv6 支持。
It works well for me!
这对我来说很有效!
回答by Tim
Check the device log
查看设备日志
It may occur, that you are using a provisioning profile, which does not allow one of the entitlements, listed for your target.
可能会发生,您使用的配置文件不允许为您的目标列出的权利之一。
For example
例如
entitlement 'entitlement-name' has value not permitted by provisioning profile 'Your Profile Name'
权利“权利名称”具有供应配置文件“您的配置文件名称”不允许的值