xcode 在模拟器中手动安装的应用程序在加载时崩溃
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32905869/
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
Apps manually installed in simulator crashes upon load
提问by Aleksander Azizi
I'm installing MyApp
on the iOS simulator (Xcode 7, iOS 9) using xcrun simctl install booted MyPath/MyApp.app
.
我正在MyApp
使用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:
但是,手动或使用启动应用程序xcrun simctl launch booted com.company.MyApp
失败。返回错误:
An error was encountered processing the command (domain=FBSOpenApplicationErrorDomain, code=1): The operation couldn't be completed. (FBSOpenApplicationErrorDomain error 1.)
处理命令时遇到错误(域=FBSOpenApplicationErrorDomain,代码=1):操作无法完成。(FBSOpenApplicationErrorDomain 错误 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).
该应用程序是从 Xcode 导出的(请注意,从 Xcode 运行该应用程序或从其源代码重新构建该应用程序不是一个可靠的解决方案)。
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.
com.apple.CoreSimulator.SimDevice.CA35ED48-DDAA-4CF0-8C69-C206CC55A6EB.launchd_sim[4200] (UIKitApplication:com.company.MyApp[0xe9ec][4281]):服务指定的程序不包含请求的架构之一:R
SpringBoard[4217]:无法获得 'UIKitApplication:com.company.MyApp[0xe9ec]' 的 pid:没有这样的过程(错误 3)
SpringBoard[4217]:引导失败
SpringBoard[4217]:应用程序 'UIKitApplication:com.company.MyApp[0xe9ec]' 自愿退出。
SpringBoard[4217]:CGContextSaveGState:无效的上下文 0x0。如果要查看回溯,请设置 CG_CONTEXT_SHOW_BACKTRACE 环境变量。
SpringBoard[4217]:CGContextTranslateCTM:无效的上下文 0x0。如果要查看回溯,请设置 CG_CONTEXT_SHOW_BACKTRACE 环境变量。
SpringBoard[4217]:CGContextRestoreGState:无效的上下文 0x0。如果要查看回溯,请设置 CG_CONTEXT_SHOW_BACKTRACE 环境变量。
SpringBoard[4217]:CGContextSaveGState:无效的上下文 0x0。如果要查看回溯,请设置 CG_CONTEXT_SHOW_BACKTRACE 环境变量。
SpringBoard[4217]:CGContextTranslateCTM:无效的上下文 0x0。如果要查看回溯,请设置 CG_CONTEXT_SHOW_BACKTRACE 环境变量。
SpringBoard[4217]:CGContextRestoreGState:无效的上下文 0x0。如果要查看回溯,请设置 CG_CONTEXT_SHOW_BACKTRACE 环境变量。
com.apple.CoreSimulator.SimDevice.CA35ED48-DDAA-4CF0-8C69-C206CC55A6EB.launchd_sim[4200] (UIKitApplication:com.company.MyApp[0xc82f][4282]):服务指定的程序不包含请求的架构之一:R
SpringBoard[4217]:无法获得 'UIKitApplication:com.company.MyApp[0xc82f]' 的 pid:没有这样的过程(错误 3)
SpringBoard[4217]:引导失败
SpringBoard[4217]:应用程序 'UIKitApplication:com.company.MyApp[0xc82f]' 自愿退出。
The architectures
error varies the variable. R, f, etc.
该architectures
错误改变变量。R、f 等。
What's the causing this issue? How may I resolve it?
造成这个问题的原因是什么?我该如何解决?
回答by Decept
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".
我有同样的问题,但使用 Xamarin。在 Visual Studio 中,我通过转到 iOS 项目属性并在“iOS 构建”下将“支持的体系结构”从“i386”更改为“i386 + x86_64”来解决它。
Hopefully you can adapt that to XCode.
希望你能适应 XCode。
回答by Chicowitz
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.
我在 Xcode 6 中使用目录“Release-iphoneos”而不是“Release-iphonesimulator”中的 .app 文件时遇到了这个问题。此文件有多个版本,您需要更改安装命令中的路径以指向正确的版本。
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)
如果此 .app 文件是由某人/其他人发送给您的,则它可能是来自错误目录的副本(不是为模拟器构建的)
回答by kane morgan
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.
如果您使用错误的 sdk,就会发生这种情况。如果项目是使用物理设备 sdk 构建的,当您尝试在模拟器上打开它时,它会在启动时崩溃。
If you are building it from the command line with xcrun xcodebuild check thet the sdk is "iphonesimulator" not "iphoneos"
如果您使用 xcrun xcodebuild 从命令行构建它,请检查 sdk 是“iphonesimulator”而不是“iphoneos”
e.g
xcrun xcodebuild -scheme <yourScheme> -configuration Debug -project <yourProject>.xcodeproj -sdk iphonesimulator build
例如
xcrun xcodebuild -scheme <yourScheme> -configuration Debug -project <yourProject>.xcodeproj -sdk iphonesimulator build
回答by Allen
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.
当您说从 Xcode 导出时,您是指从 iOS App Archive 导出吗?如果是这样,您就会错过一个重要的事实,即这些包是为 iOS 而不是模拟器构建的,正如 Nanoc 指出的那样,这是完全不同的架构。
You are trying to achieve an impossible solution to your problem.
您正试图为您的问题找到一个不可能的解决方案。