使用 xcodebuild 构建的 iPhone 应用程序在模拟器中崩溃
我一直在尝试编写一个脚本来构建 iphone 项目并将其部署到模拟器。当我在 xcode 中构建项目时,它工作正常,但是当我在命令行中构建项目时,它在模拟器中崩溃。
我正在使用以下命令来构建应用程序。
xcodebuild -project MyAppSourceCode/trunk/MyApp.xcodeproj -target "MyApp" -sdk iphonesimulator4.3
构建过程完成且没有错误。模拟器运行的是sdk4.3。我可以在 xcode 中构建应用程序,然后手动替换模拟器目录中的 .app 文件,但它仍然崩溃。这是一个cocos2d应用程序。有什么建议吗?
编辑:
我通过首先尝试此处描述的“iphonesim”程序在模拟器中部署应用程序: 如何从命令行将 iPhone 应用程序部署到模拟器?
其次,我尝试使用模拟器命令来启动应用程序,而不将其复制到模拟器目录: 〜/../../Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication 〜/MyAppSourceCode/trunk/build/Release-iphoneos/MyApp.app /MyApp
此方法会导致模拟器启动,然后显示一条弹出消息:“模拟应用程序退出。”
当这不起作用时,我编写了一个脚本,将 MyApp.app 复制到模拟器目录。将 MyApp.app 复制到模拟器目录后,您可以从模拟器启动它,但启动后立即崩溃。
I have been trying to write a script that builds and deploys a iphone project to the simulator. When I build the project in xcode it works fine, however when I build the project in the command line, it crashes in the simulator.
I am using the following command to build the app.
xcodebuild -project MyAppSourceCode/trunk/MyApp.xcodeproj -target "MyApp" -sdk iphonesimulator4.3
The build proces completes without errors. The simulator is running sdk4.3. I can build the app in xcode then manually replace the .app file in the simulator directory and it still crashes. This is a cocos2d app. Any suggestions?
EDIT:
I deployed the app in the simulator by first trying the "iphonesim" program described here: How do you deploy an iPhone app to the simulator from the command line?
Second, I tried the simulator command for launching the app without copying it to the simulator directory: ~/../../Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication ~/MyAppSourceCode/trunk/build/Release-iphoneos/MyApp.app/MyApp
This method results in the simulator launching then displaying a pop up message that says: "The simulated application quit."
When that didn't work I wrote a script that copies the MyApp.app to the simulator directory. After you copy the MyApp.app into the simulator directory, you can launch it from the simulator, but it crashes immediately after launch.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请注意,默认情况下使用 xcodebuild 的命令行构建使用 RELEASE 配置。在 Xcode 中默认为 DEBUG。
这意味着您可能会遇到仅在发布版本中发生的崩溃错误。要验证,请尝试通过修改方案来构建发布配置,在发布配置中的 Xcode 中运行应用程序。
Take note that by default command line builds with xcodebuild use the RELEASE configuration. In Xcode the default is DEBUG.
That means you may have a crash bug that only occurs in release builds. To verify try running the app within Xcode in the release configuration by modifying the scheme to build the release configuration.