Ios SKLabelNode崩溃

Ios SKLabelNode崩溃,ios,crash,sprite-kit,ios9,sklabelnode,Ios,Crash,Sprite Kit,Ios9,Sklabelnode,新类总是在设备iOS 9上崩溃,在NewLabel上访问错误(文本:“”) 为什么? 导入SpriteKit 类NewLabel:SKLabelNode{ 覆盖变量文本:字符串{ 迪塞特{ } } } *线程#1:tid=0x8c839,0x000000018577ce38 CoreFoundation`CFStringCreateCopy+32,队列='com.apple.main thread',停止原因=EXC_坏访问(代码=1,地址=0x0) 帧#0:0x000000018577ce38

新类总是在设备iOS 9上崩溃,在NewLabel上访问错误(文本:“”)

为什么?

导入SpriteKit
类NewLabel:SKLabelNode{
覆盖变量文本:字符串{
迪塞特{
}
}
}
*线程#1:tid=0x8c839,0x000000018577ce38 CoreFoundation`CFStringCreateCopy+32,队列='com.apple.main thread',停止原因=EXC_坏访问(代码=1,地址=0x0)
帧#0:0x000000018577ce38 CoreFoundation`CFStringCreateCopy+32

frame#1:0x0000000100ee49d8 libswiftCore.dylib`函数签名专用化

SKLabelNode的文本属性在iOS9中是可选的


覆盖变量文本:字符串?
应该可以工作。

显示完整的异常文本和堆栈跟踪。您可以复制它。在新项目中创建类,然后只创建它。
import SpriteKit

class NewLabel : SKLabelNode {

override var text: String {
    didSet {

    }
}

}


* thread #1: tid = 0x8c839, 0x000000018577ce38 CoreFoundation`CFStringCreateCopy + 32, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x000000018577ce38 CoreFoundation`CFStringCreateCopy + 32
frame #1: 0x0000000100ee49d8 libswiftCore.dylib`function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Dead> of Swift.String.init (Swift.String.Type)(_cocoaString : Swift.AnyObject) -> Swift.String + 108
frame #2: 0x0000000100ec85b0 libswiftCore.dylib`Swift.String.init (Swift.String.Type)(_cocoaString : Swift.AnyObject) -> Swift.String + 24
frame #3: 0x0000000100112eac Project`Project.NewLabel.text.setter : Swift.String(newValue=Swift.String at 0x000000016fd259d8, self=0x0000000154fd7d30) + 124 at NewLabel.swift:0
frame #4: 0x0000000100112e24 Project`@objc Project.NewLabel.text.setter : Swift.String + 72 at NewLabel.swift:0
frame #5: 0x000000018ac78528 SpriteKit`+[SKLabelNode labelNodeWithText:] + 96
frame #6: 0x000000010014b5c0 Project`@!objc ObjectiveC.SKLabelNode.__allocating_init (ObjectiveC.SKLabelNode.Type)(text : Swift.String) -> ObjectiveC.SKLabelNode + 84 at AppDelegate.swift:0
* frame #7: 0x0000000100148fb4 Project`Project.AppDelegate.application (application=0x0000000154fbe420, launchOptions=None, self=0x0000000154d351e0)(ObjectiveC.UIApplication, didFinishLaunchingWithOptions : Swift.Optional<Swift.Dictionary<ObjectiveC.NSObject, Swift.AnyObject>>) -> Swift.Bool + 96 at AppDelegate.swift:21
frame #8: 0x000000010014a5f4 Project`@objc Project.AppDelegate.application (Project.AppDelegate)(ObjectiveC.UIApplication, didFinishLaunchingWithOptions : Swift.Optional<Swift.Dictionary<ObjectiveC.NSObject, Swift.AnyObject>>) -> Swift.Bool + 204 at AppDelegate.swift:0
frame #9: 0x000000018ae5f1a0 UIKit`-[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 400
frame #10: 0x000000018b087e7c UIKit`-[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2904
frame #11: 0x000000018b08c1c0 UIKit`-[UIApplication _runWithMainScene:transitionContext:completion:] + 1660
frame #12: 0x000000018b089300 UIKit`-[UIApplication workspaceDidEndTransaction:] + 168
frame #13: 0x000000018f5db7ec FrontBoardServices`-[FBSSerialQueue _performNext] + 184
frame #14: 0x000000018f5dbb6c FrontBoardServices`-[FBSSerialQueue _performNextFromRunLoopSource] + 56
frame #15: 0x000000018584c5a4 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
frame #16: 0x000000018584c038 CoreFoundation`__CFRunLoopDoSources0 + 540
frame #17: 0x0000000185849d38 CoreFoundation`__CFRunLoopRun + 724
frame #18: 0x0000000185778dc0 CoreFoundation`CFRunLoopRunSpecific + 384
frame #19: 0x000000018ae580c8 UIKit`-[UIApplication _run] + 460
frame #20: 0x000000018ae52f60 UIKit`UIApplicationMain + 204
frame #21: 0x000000010014b2e0 Project`main + 164 at AppDelegate.swift:14
frame #22: 0x000000019acb28b8 libdyld.dylib`start + 4