简体   繁体   中英

iPhone App built with xcodebuild crashes in the simulator

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM