Xcode 9 Crashing while setting a Texture in SKScen

2019-03-15 15:26发布

I am building a game in Spritekit with Xcode currently. After updating to Xcode 9 I've found that every time I set a texture through the .sks file, Xcode crashes instantly. I've restarted my computer, updated the app, reloaded the textures and nothing changed. I have the 2017 Macbook Prof 13" w/ touch bar. Here are the diagnostics:

Process:               Xcode [577]
Path:                  /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:            com.apple.dt.Xcode
Version:               9.0.1 (13249)
Build Info:            IDEFrameworks-13249000000000000~2
App Item ID:           497799835
App External ID:       823984564
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Xcode [577]
User ID:               501

Date/Time:             2017-10-22 17:30:06.029 -0400
OS Version:            Mac OS X 10.12.6 (16G29)
Report Version:        12
Anonymous UUID:        0537A8C3-9FB2-836A-088B-E5D2B7FEB3EB


Time Awake Since Boot: 100 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: SKCRenderer_resource_queue

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x000000012ceef7b8
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Bus error: 10
Termination Reason:    Namespace SIGNAL, Code 0xa
Terminating Process:   exc handler [0]

VM Regions Near 0x12ceef7b8:
    MALLOC_LARGE           000000012ceaf000-000000012ceef000 [  256K] rw-/rwx SM=PRV  
--> mapped file            000000012ceef000-000000012cf22000 [  204K] r--/rw- SM=COW  
    MALLOC_LARGE           000000012cf31000-000000012cf71000 [  256K] rw-/rwx SM=PRV  

Application Specific Information:
Sending userDidChangeValue: to <SKInspectorTextureProperty: 0x7fadb2219440> from <NSComboBox: 0x7fadb221ad80>
ProductBuildVersion: 9A1004
Performing @selector(userDidChangeValue:) from sender NSComboBox 0x7fadb221ad80

9条回答
够拽才男人
2楼-- · 2019-03-15 16:06

I had the same issue and what worked for me was to bypass using .xcassets all together. I simply added a folder to my project and imported the images into the folder. After that, assigning texture in the scene editor no longer crashed Xcode

查看更多
萌系小妹纸
3楼-- · 2019-03-15 16:09

I solved the crashing problem.

The problem is with your @2x and @3x images. With those present in your Assets.xcassets folder - the SKS node will crash XCODE.

  1. Add ONLY the 1x image to your Assets.xcassets folder.
  2. place a Color Node onto your SKS scene.
  3. select a texture
  4. resize the texture.
  5. add your @2x and @3x files later.

This solution works 100% each and every time.

查看更多
等我变得足够好
4楼-- · 2019-03-15 16:14

I was having this problem with only one of my sprite textures causing the Xcode sprite editor to crash (even after removing the @2x and @3x images). It had an image DPI of 300 pixels/inch. I changed it to 72 pixels/inch which matches the other sprite textures. No more crash.

I hope this helps someone. This bug in Xcode's sprite editor has been around for quite a few versions of Xcode and is a real productivity killer. Keep submitting those bug reports to apple.

查看更多
甜甜的少女心
5楼-- · 2019-03-15 16:23

I think it is due to your computer: MacBook Pro (13-inch, 2017), which is also my workstation now.

I have tested the same project (simply created by the game template with an identical texture image) on the following computers with Mojave 10.14 and Xcode 10.1 installed:

Mac mini server( later 2012) iMac, 27 (Middle 2011) MacBook Pro, 13 (Middle 2014) MacBook Air, 13(Middle 2014) MacBook Pro, 15(Middle 2014) All of the above computers work well.

One more weird thing happens when I project my MacBook Pro(13-inch, 2017) through the AirPlay, it does not crash anymore.

查看更多
倾城 Initia
6楼-- · 2019-03-15 16:25

There is a great workaround on the Apple forums.

How to fix your .sks file :

  • Open your .sks file outside the project (close your project and open the file directly from Finder)

  • You should see red crosses instead of the Sprites, delete the Texture name information for all of them.

  • Now, you should be able to reopen the file from the project.

  • Finally, reenter the Texture name for all your Sprites.

查看更多
Animai°情兽
7楼-- · 2019-03-15 16:29

OHM,I found the reason It will occurs if your image not equal ratio with current size of skspritenode on storyboard Good Luck!

查看更多
登录 后发表回答