[英]Xcode 8.2 simulator crash when save screen shot
After update XCode 8.2, every time save simulator screen shot always made it crash. 更新XCode 8.2后,每次保存模拟器屏幕截图总是让它崩溃。 Even I reset content and settings still crash. 即使我重置内容和设置仍然崩溃。
Should I remove all simulator and install them again? 我应该删除所有模拟器并重新安装吗?
Update : 更新 :
The following is the crash report: 以下是崩溃报告:
Process: Simulator [48928]
Path: /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator
Identifier: com.apple.iphonesimulator
Version: 10.0 (726.7)
Build Info: Indigo-726007000000000~5
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Simulator [48928]
User ID: 501
PlugIn Path: /Applications/Xcode.app/Contents/Frameworks/libswiftFoundation.dylib
PlugIn Identifier: libswiftFoundation.dylib
PlugIn Version: 3.0.2 (800.0.63)
Date/Time: 2016-12-13 23:43:25.860 +0800
OS Version: Mac OS X 10.11.6 (15G1108)
Report Version: 11
Anonymous UUID: 6E8AEBAE-0AF8-D350-66D6-57EC500D69F5
Sleep/Wake UUID: 6E017B49-1A38-4D3A-AB8F-FD9E200B6286
Time Awake Since Boot: 110000 seconds
Time Since Wake: 10000 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: EXC_I386_GPFLT
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
Performing @selector(saveScreenShot:) from sender NSMenuItem 0x7fd05a7329f0
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff946adcdc lookUpImpOrForward + 135
1 libobjc.A.dylib 0x00007fff946a8591 objc_msgSend + 209
2 libsystem_blocks.dylib 0x00007fff9b684986 _Block_object_assign + 364
3 com.apple.Foundation 0x00007fff8dc21ca4 __copy_helper_block_ + 49
4 libsystem_blocks.dylib 0x00007fff9b68459d _Block_copy_internal + 325
5 libswiftFoundation.dylib 0x000000010178af95 _TToFC10Foundation12_SwiftNSData19enumerateByteRangesfT5usingFTSVVSC8_NSRangeGSpV10ObjectiveC8ObjCBool__T__T_ + 21
6 com.apple.Foundation 0x00007fff8db02a94 _NSWriteDataToFileWithExtendedAttributes + 742
7 com.apple.iphonesimulator 0x0000000100ffdc1e 0x100ff1000 + 52254
8 com.apple.iphonesimulator 0x0000000100ffdda9 0x100ff1000 + 52649
9 libsystem_trace.dylib 0x00007fff9a5bd07a _os_activity_initiate + 75
10 com.apple.AppKit 0x00007fff909d4dbd -[NSApplication sendAction:to:from:] + 460
11 com.apple.AppKit 0x00007fff909d4b57 -[NSMenuItem _corePerformAction] + 336
12 com.apple.AppKit 0x00007fff909d48b7 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 114
13 libsystem_trace.dylib 0x00007fff9a5bd07a _os_activity_initiate + 75
14 com.apple.AppKit 0x00007fff909d37a5 -[NSMenu performKeyEquivalent:] + 357
15 com.apple.AppKit 0x00007fff909d2949 -[NSApplication _handleKeyEquivalent:] + 920
16 com.apple.AppKit 0x00007fff908f90fe -[NSApplication sendEvent:] + 4274
17 com.apple.iphonesimulator 0x000000010100d151 0x100ff1000 + 115025
18 com.apple.AppKit 0x00007fff9075fdf2 -[NSApplication run] + 796
19 com.apple.AppKit 0x00007fff90729368 NSApplicationMain + 1176
20 libdyld.dylib 0x00007fff99c955ad start + 1
Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff97827efa kevent_qos + 10
1 libdispatch.dylib 0x00007fff9612d165 _dispatch_mgr_invoke + 216
2 libdispatch.dylib 0x00007fff9612cdcd _dispatch_mgr_thread + 52
Thread 2:: com.apple.NSEventThread
0 libsystem_kernel.dylib 0x00007fff97820f72 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff978203b3 mach_msg + 55
2 com.apple.CoreFoundation 0x00007fff97319124 __CFRunLoopServiceMachPort + 212
3 com.apple.CoreFoundation 0x00007fff973185ec __CFRunLoopRun + 1356
4 com.apple.CoreFoundation 0x00007fff97317e38 CFRunLoopRunSpecific + 296
5 com.apple.AppKit 0x00007fff908c1d95 _NSEventThread + 149
6 libsystem_pthread.dylib 0x00007fff928a299d _pthread_body + 131
7 libsystem_pthread.dylib 0x00007fff928a291a _pthread_start + 168
8 libsystem_pthread.dylib 0x00007fff928a0351 thread_start + 13
Thread 3:
0 libsystem_kernel.dylib 0x00007fff978275e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff928a2578 _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x00007fff928a0341 start_wqthread + 13
Thread 4:
0 libsystem_kernel.dylib 0x00007fff978275e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff928a2578 _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x00007fff928a0341 start_wqthread + 13
Thread 5:
0 libsystem_kernel.dylib 0x00007fff978275e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff928a2578 _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x00007fff928a0341 start_wqthread + 13
Thread 6:
0 libsystem_kernel.dylib 0x00007fff978275e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff928a2578 _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x00007fff928a0341 start_wqthread + 13
Thread 7:
0 libsystem_kernel.dylib 0x00007fff978275e2 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff928a2578 _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x00007fff928a0341 start_wqthread + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00007fff6382b2c0 rbx: 0x00007fff6384ce48 rcx: 0x021b77058d48fb89 rdx: 0x00007fff638545f8
rdi: 0x00007fff6384ce48 rsi: 0x00007fff976efa45 rbp: 0x00007fff5ec0dc30 rsp: 0x00007fff5ec0dbe0
r8: 0x0000000000000000 r9: 0x0000000000000001 r10: 0x00007fff93c7d1e0 r11: 0x00007fff6384ce48
r12: 0x00007fff976efa45 r13: 0x0000000000000000 r14: 0x0000000000000001 r15: 0x00007ffffffffff8
rip: 0x00007fff946adcdc rfl: 0x0000000000010206 cr2: 0x00007fff93c7c000
The crash seems to occur due to a segmentation fault, or more specifically a general protection fault, while calling the saveScreenShot:
selector. 在调用saveScreenShot:
选择器时,崩溃似乎是由于分段错误或更具体的一般保护错误而发生的。 Why it happens can depend on several things, so it's hard to say whether a reinstall would help. 它为什么会发生可能取决于几个方面,因此很难说重新安装会有所帮助。
In any case, if the screenshot (⌘S) function in simulator causes the crash, there's hardly anything you can do about it. 在任何情况下,如果模拟器中的屏幕截图(⌘S)功能导致崩溃,那么你几乎无能为力。 The best option you have is probably to file a bug report to Apple . 您拥有的最佳选择可能是向Apple提交错误报告 。
Update: 更新:
I just updated to the 8.2 GM, and low and behold, ⌘S crashes for me as well. 我刚刚更新到8.2 GM,并且低,⌘S也为我崩溃了。 Although I'm getting KERN_INVALID_ADDRESS
instead of EXC_I386_GPFLT
. 虽然我得到KERN_INVALID_ADDRESS
而不是EXC_I386_GPFLT
。
One workaround, for the time being, is copying the screen and pasting into Preview: 目前,一种解决方法是复制屏幕并粘贴到预览中:
Yeah, unfortunately, this is tripping over a bug in Foundation on OS X 10.11. 是的,不幸的是,这是在OS X 10.11的基础上绊倒了一个错误。 You won't have the problem if you upgrade to macOS Sierra. 如果升级到macOS Sierra,则不会出现问题。
If you cannot upgrade to Sierra right now, you can still take screenshots from the commandline: 如果您现在无法升级到Sierra,您仍然可以从命令行截取屏幕截图:
xcrun simctl io booted screenshot <path to output file>
This is mentioned in the Xcode 8.2 Release Notes 这在Xcode 8.2发行说明中提到
Simulator can crash when saving a screenshot when running on OS X El Capitan. 在OS X El Capitan上运行时保存屏幕截图时,模拟器可能会崩溃。 (29182710) The crash does not occur on macOS Sierra. (29182710)macOS Sierra上没有发生崩溃。
Please find the below steps for getting the screenshot. 请参阅以下步骤以获取屏幕截图。
1) Go to Simulators -> Edit -> Copy Screen or you can use the shortcut ( ctrl + cmd + c ). 1)转到模拟器 - >编辑 - >复制屏幕,或者您可以使用快捷键( ctrl + cmd + c )。
2) Open the Preview and go to File -> New from Clipboard or you can use the shortcut ( cmd + n ). 2)打开预览并转到文件 - >从剪贴板新建,或者您可以使用快捷方式( cmd + n )。
3) Now go to File -> Save or you can use the shortcut ( cmd + s ). 3)现在转到文件 - >保存,或者您可以使用快捷方式( cmd + s )。
Or you can also refer the below GIF presentation. 或者您也可以参考以下GIF演示文稿。
So an easier workaround is this: 所以一个更简单的解决方法是:
Run app in simulator (obviously) 在模拟器中运行应用程序(显然)
In simulator go to Edit>Copy Screen 在模拟器中,转到编辑>复制屏幕
Done! 完成!
Not sure why this prevents the bug from occurring but it worked for me. 不知道为什么这可以防止错误发生但它对我有用。 It's faster than all the other methods described above. 它比上述所有其他方法更快。
Solution 1 解决方案1
1) Go to Simulators > Edit > Copy Screen (⌃⌘C) 1)转到模拟器>编辑>复制屏幕(^⌘C)
2) Open Preview App > Go to File > New from Clipboard (⌘N) and Save (⌘S) to your favorite location on your machine 2)打开预览应用>转到文件>从剪贴板新建(⌘N)并保存(⌘S)到您计算机上您最喜欢的位置
Solution 2:- Using the xcrun Xcode command-line utility 解决方案2: - 使用xcrun Xcode命令行实用程序
Open Terminal App
and run the following command to take screenshot 打开Terminal App
并运行以下命令以截屏
xcrun simctl io booted screenshot
If you wish to save the captured screenshot to specific location 如果您希望将捕获的屏幕截图保存到特定位置
xcrun simctl io booted screenshot <path_to_output_file>
Another convenient way -> Shift+Command+4 - tap the space bar, tap on the window to get snapshot of the Simulator's window. 另一种方便的方法 - > Shift + Command + 4 - 点击空格键,点击窗口以获取模拟器窗口的快照。
https://support.apple.com/en-us/HT201361 https://support.apple.com/en-us/HT201361
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.