Apps manually installed in simulator crashes upon

2019-02-11 21:52发布

问题:

I'm installing MyApp on the iOS simulator (Xcode 7, iOS 9) using xcrun simctl install booted MyPath/MyApp.app.

This works as expected and the app is installed on the simulator.

However, launching the app either manually or using xcrun simctl launch booted com.company.MyApp fails. Giving back the error:

An error was encountered processing the command (domain=FBSOpenApplicationErrorDomain, code=1): The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.)

The app is exported from Xcode (note that running the app from Xcode or re-building the app from its source code is not a liable solution).

It's not app specific, as any app install in this manner crashes with the same error.

The system log reports the same error, but with some additional information.

com.apple.CoreSimulator.SimDevice.CA35ED48-DDAA-4CF0-8C69-C206CC55A6EB.launchd_sim[4200] (UIKitApplication:com.company.MyApp[0xe9ec][4281]): Program specified by service does not contain one of the requested architectures: R

SpringBoard[4217]: Unable to get pid for 'UIKitApplication:com.company.MyApp[0xe9ec]': No such process (err 3)

SpringBoard[4217]: Bootstrapping failed for

SpringBoard[4217]: Application 'UIKitApplication:com.company.MyApp[0xe9ec]' exited voluntarily.

SpringBoard[4217]: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

SpringBoard[4217]: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

SpringBoard[4217]: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

SpringBoard[4217]: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

SpringBoard[4217]: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

SpringBoard[4217]: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

com.apple.CoreSimulator.SimDevice.CA35ED48-DDAA-4CF0-8C69-C206CC55A6EB.launchd_sim[4200] (UIKitApplication:com.company.MyApp[0xc82f][4282]): Program specified by service does not contain one of the requested architectures: R

SpringBoard[4217]: Unable to get pid for 'UIKitApplication:com.company.MyApp[0xc82f]': No such process (err 3)

SpringBoard[4217]: Bootstrapping failed for

SpringBoard[4217]: Application 'UIKitApplication:com.company.MyApp[0xc82f]' exited voluntarily.

The architectures error varies the variable. R, f, etc.

What's the causing this issue? How may I resolve it?

回答1:

I had the same problem, but using Xamarin. In Visual Studio I solved it by going to the iOS project properties and under "iOS Build" I changed the "Supported architectures" from "i386" to "i386 + x86_64".

Hopefully you can adapt that to XCode.



回答2:

I encountered this problem in Xcode 6 when using the .app file in directory "Release-iphoneos" instead of "Release-iphonesimulator". There are multiple versions of this file, and you need to change the path in your install command to point to the correct one.

If this .app file was sent to you by someone/something else, it may be a copy from the wrong directory (not built for a simulator)



回答3:

when you say you export from Xcode, are you referring to export from iOS App Archive? if so you are missing an important fact that these package are build for iOS not Simulator which is totally different architecture as Nanoc pointed out.

You are trying to achieve an impossible solution to your problem.



回答4:

This can happen if you use the wrong sdk. If the project is built using the physical device sdk it crashes on start up when you try to open it on the simulator.

If you are building it from the command line with xcrun xcodebuild check thet the sdk is "iphonesimulator" not "iphoneos"

e.g xcrun xcodebuild -scheme <yourScheme> -configuration Debug -project <yourProject>.xcodeproj -sdk iphonesimulator build