问题描述
我目前正在使用 Xcode 在 Spritekit 中构建游戏.更新到 Xcode 9 后,我发现每次通过 .sks 文件设置纹理时,Xcode 都会立即崩溃.我重新启动了计算机,更新了应用程序,重新加载了纹理,但没有任何变化.我有带触摸条的 2017 年 Macbook Prof 13".以下是诊断信息:
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
推荐答案
我解决了崩溃问题.
问题在于您的 @2x 和 @3x 图像.如果这些存在于 Assets.xcassets 文件夹中 - SKS 节点将使 XCODE 崩溃.
The problem is with your @2x and @3x images. With those present in your Assets.xcassets folder - the SKS node will crash XCODE.
- 仅将 1x 图像添加到 Assets.xcassets 文件夹中.
- 在您的 SKS 场景中放置一个颜色节点.
- 选择纹理
- 调整纹理大小.
- 稍后添加@2x 和@3x 文件.
此解决方案每次都 100% 有效.
This solution works 100% each and every time.
这篇关于在 Spritekit 中的 SKScene 中设置纹理时 Xcode 9 崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!