2
新類在設備iOS 9上總是崩潰,NewLabel上的訪問不良(text:「」)。SKLabelNode崩潰
爲什麼?
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
我發現精靈套件propeties被改變(左Xcode 6.4 - 右Xcode 7)。
顯示完整的異常文本和堆棧跟蹤。 – trojanfoe
您可以重現它。在新項目中創建課程並創建它。 –