实例化子类在Swift playgrounds中有效,但使用该类本身却不行

实例化子类在Swift playgrounds中有效,但使用该类本身却不行,swift,xcode,swift-playground,audiokit,Swift,Xcode,Swift Playground,Audiokit,我已经对AudioKit的代码进行了更新,现在游乐场(在开发分支上)并不都能正常工作,在研究中,我发现了一个奇怪的例子 var oscillator = AKOscillator() 生成崩溃,但只需使用该类的一个子类: class AKSubclassOfOscillator: AKOscillator {} var oscillator = AKSubclassOfOscillator() 效果非常好。有人能解释一下这是怎么发生的吗?这个快速操场在Xcode 10中运行/崩溃。应用程序中

我已经对AudioKit的代码进行了更新,现在游乐场(在开发分支上)并不都能正常工作,在研究中,我发现了一个奇怪的例子

var oscillator = AKOscillator()
生成崩溃,但只需使用该类的一个子类:

class AKSubclassOfOscillator: AKOscillator {}
var oscillator = AKSubclassOfOscillator()
效果非常好。有人能解释一下这是怎么发生的吗?这个快速操场在Xcode 10中运行/崩溃。应用程序中的类似代码不会崩溃,只会在操场中崩溃

这是日志

Playground execution failed:

error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x0).
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x000000010c8b2d2f libswiftCore.dylib`swift_getObjectType + 47
    frame #1: 0x000000010c86a855 libswiftCore.dylib`findDynamicValueAndType(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*&, swift::TargetMetadata<swift::InProcess> const*&, bool&, bool, bool) + 245
    frame #2: 0x000000010c86efa7 libswiftCore.dylib`_dynamicCastToExistential(swift::OpaqueValue*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetExistentialTypeMetadata<swift::InProcess> const*, swift::DynamicCastFlags) + 135
    frame #3: 0x000000010cbda1b7 PlaygroundLogger`___lldb_unnamed_symbol258$$PlaygroundLogger + 599
    frame #4: 0x000000010cbdc8e6 PlaygroundLogger`___lldb_unnamed_symbol269$$PlaygroundLogger + 262
    frame #5: 0x000000010cbdf02c PlaygroundLogger`___lldb_unnamed_symbol298$$PlaygroundLogger + 76
    frame #6: 0x000000010cbdf6f9 PlaygroundLogger`___lldb_unnamed_symbol333$$PlaygroundLogger + 9
    frame #7: 0x000000010cbdf07f PlaygroundLogger`___lldb_unnamed_symbol300$$PlaygroundLogger + 31
    frame #8: 0x000000010cbdf609 PlaygroundLogger`___lldb_unnamed_symbol318$$PlaygroundLogger + 9
    frame #9: 0x000000010c58a50f libswiftCore.dylib`(extension in Swift):Swift.Collection.map<A>((A.Element) throws -> A1) throws -> Swift.Array<A1> + 527
    frame #10: 0x000000010c6d600e libswiftCore.dylib`protocol witness for Swift.Sequence.map<A>((A.Element) throws -> A1) throws -> Swift.Array<A1> in conformance Swift.LazyMapCollection<A, B> : Swift.Sequence in Swift + 78
    frame #11: 0x000000010c783347 libswiftCore.dylib`Swift._RandomAccessCollectionBox._map<A>((A.Element) throws -> A1) throws -> Swift.Array<A1> + 135
    frame #12: 0x000000010cbdcbaf PlaygroundLogger`___lldb_unnamed_symbol270$$PlaygroundLogger + 383
    frame #13: 0x000000010cbde62d PlaygroundLogger`___lldb_unnamed_symbol284$$PlaygroundLogger + 1357
    frame #14: 0x000000010cbdcd1a PlaygroundLogger`___lldb_unnamed_symbol270$$PlaygroundLogger + 746
    frame #15: 0x000000010cbde62d PlaygroundLogger`___lldb_unnamed_symbol284$$PlaygroundLogger + 1357
    frame #16: 0x000000010cbdbc84 PlaygroundLogger`___lldb_unnamed_symbol258$$PlaygroundLogger + 7460
    frame #17: 0x000000010cbd5752 PlaygroundLogger`___lldb_unnamed_symbol179$$PlaygroundLogger + 114
    frame #18: 0x000000010cbd78e8 PlaygroundLogger`playground_log_hidden + 264
    frame #19: 0x000000010d1e9427 $__lldb_expr10`main at Oscillator.xcplaygroundpage:16
    frame #20: 0x0000000108f881a0 com.apple.dt.Xcode.PlaygroundStub-macosx
    frame #21: 0x00007fff3643bf8c CoreFoundation`__invoking___ + 140
    frame #22: 0x00007fff3643be5f CoreFoundation`-[NSInvocation invoke] + 311
    frame #23: 0x00007fff3649d53d CoreFoundation`-[NSInvocation invokeWithTarget:] + 56
    frame #24: 0x00007fff5f53cbf5 ViewBridge`__68-[NSVB_ViewServiceImplicitAnimationDecodingProxy forwardInvocation:]_block_invoke_2 + 46
    frame #25: 0x00007fff5f501ec6 ViewBridge`-[NSViewServiceMarshal withHostWindowFrameAnimationInProgress:perform:] + 53
    frame #26: 0x00007fff5f53cbbe ViewBridge`__68-[NSVB_ViewServiceImplicitAnimationDecodingProxy forwardInvocation:]_block_invoke + 113
    frame #27: 0x00007fff33a19731 AppKit`+[NSAnimationContext runAnimationGroup:] + 55
    frame #28: 0x00007fff33a196e7 AppKit`+[NSAnimationContext runAnimationGroup:completionHandler:] + 82
    frame #29: 0x00007fff5f55f154 ViewBridge`runAnimationGroup + 295
    frame #30: 0x00007fff5f53c695 ViewBridge`+[NSVB_View _animateWithAttributes:animations:completion:] + 490
    frame #31: 0x00007fff5f53cb28 ViewBridge`-[NSVB_ViewServiceImplicitAnimationDecodingProxy forwardInvocation:] + 206
    frame #32: 0x00007fff3648580e CoreFoundation`___forwarding___ + 780
    frame #33: 0x00007fff36485478 CoreFoundation`__forwarding_prep_0___ + 120
    frame #34: 0x00007fff3643bf8c CoreFoundation`__invoking___ + 140
    frame #35: 0x00007fff3643be5f CoreFoundation`-[NSInvocation invoke] + 311
    frame #36: 0x00007fff3649d53d CoreFoundation`-[NSInvocation invokeWithTarget:] + 56
    frame #37: 0x00007fff5f504973 ViewBridge`-[NSVB_QueueingProxy forwardInvocation:] + 324
    frame #38: 0x00007fff3648580e CoreFoundation`___forwarding___ + 780
    frame #39: 0x00007fff36485478 CoreFoundation`__forwarding_prep_0___ + 120
    frame #40: 0x00007fff3643bf8c CoreFoundation`__invoking___ + 140
    frame #41: 0x00007fff3643be5f CoreFoundation`-[NSInvocation invoke] + 311
    frame #42: 0x00007fff3649d53d CoreFoundation`-[NSInvocation invokeWithTarget:] + 56
    frame #43: 0x00007fff3648580e CoreFoundation`___forwarding___ + 780
    frame #44: 0x00007fff36485478 CoreFoundation`__forwarding_prep_0___ + 120
    frame #45: 0x00007fff3643bf8c CoreFoundation`__invoking___ + 140
    frame #46: 0x00007fff3643be5f CoreFoundation`-[NSInvocation invoke] + 311
    frame #47: 0x00007fff5f4d16cd ViewBridge`__deferNSXPCInvocationOntoMainThread_block_invoke + 237
    frame #48: 0x00007fff5f4c6af3 ViewBridge`__wrapBlockWithVoucher_block_invoke + 37
    frame #49: 0x00007fff5f4c68a4 ViewBridge`__deferBlockOntoMainThread_block_invoke_2 + 553
    frame #50: 0x00007fff36469ca7 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    frame #51: 0x00007fff3642cced CoreFoundation`__CFRunLoopDoBlocks + 395
    frame #52: 0x00007fff3642c3eb CoreFoundation`__CFRunLoopRun + 1204
    frame #53: 0x00007fff3642bce4 CoreFoundation`CFRunLoopRunSpecific + 463
    frame #54: 0x00007fff356c5895 HIToolbox`RunCurrentEventLoopInMode + 293
    frame #55: 0x00007fff356c55cb HIToolbox`ReceiveNextEventCommon + 618
    frame #56: 0x00007fff356c5348 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 64
    frame #57: 0x00007fff3398295b AppKit`_DPSNextEvent + 997
    frame #58: 0x00007fff339816fa AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1362
    frame #59: 0x00007fff5f4cf226 ViewBridge`-[NSViewServiceApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 92
    frame #60: 0x00007fff3397b75d AppKit`-[NSApplication run] + 699
    frame #61: 0x00007fff3396ae97 AppKit`NSApplicationMain + 780
    frame #62: 0x00007fff636fbf1f libxpc.dylib`_xpc_objc_main + 612
    frame #63: 0x00007fff636fb9e5 libxpc.dylib`xpc_main + 433
    frame #64: 0x00007fff5f4c0a76 ViewBridge`-[NSXPCSharedListener resume] + 16
    frame #65: 0x00007fff5f4c9a03 ViewBridge`NSViewServiceApplicationMain + 2877
    frame #66: 0x0000000108f881ca com.apple.dt.Xcode.PlaygroundStub-macosx`main + 42
    frame #67: 0x00007fff634c5085 libdyld.dylib`start + 1
执行失败:
错误:执行被中断,原因:EXC\u访问错误(代码=1,地址=0x0)。
进程被留在中断的位置,请使用“thread return-x”返回到表达式求值之前的状态。
*线程#1,队列='com.apple.main thread',停止原因=EXC#U BAD#U访问(代码=1,地址=0x0)
*帧0:0x000000010C8B2F2F libswiftCore.dylib`swift#u getObjectType+47
帧#1:0x000000010c86a855 libswiftCore.dylib`finddDynamicValueandType(swift::OpaqueValue*,swift::TargetMetadata const*,swift::OpaqueValue*&,swift::TargetMetadata const*&,bool&,bool)+245
帧#2:0x000000010c86efa7 libswitftcore.dylib``动态标准存在(swift::OpaqueValue*,swift::OpaqueValue*,swift::TargetMetadata const*,swift::TargetExistentialTypeMetadata const*,swift::DynamicCastFlags)+135
帧#3:0x000000010cbda1b7 PlaygroundLogger`uuuuuLLDB_unnamed_symbol258$$PlaygroundLogger+599
帧#4:0x000000010cbdc8e6 PlaygroundLogger`\uuuuuuLLDB\uUnnamed\uSYMBOL269$$PlaygroundLogger+262
帧#5:0x000000010cbdf02c PlaygroundLogger`uuuuuuLLDB_unnamed_symbol298$$PlaygroundLogger+76
帧#6:0x000000010cbdf6f9 PlaygroundLogger`\uuuuuuLLDB\uUnnamed\uSYMBOL333$$PlaygroundLogger+9
帧#7:0x000000010cbdf07f PlaygroundLogger`\uuuuuuuuLLDB\uUnnamed\uSYMBOL300$$PlaygroundLogger+31
帧#8:0x000000010cbdf609 PlaygroundLogger`\uuuuuuuLLDB\uUnnamed\uSYMBOL318$$PlaygroundLogger+9
帧#9:0x000000010c58a50f libswiftCore.dylib`(Swift中的扩展名):Swift.Collection.map((A.Element)throws->A1)throws->Swift.Array+527
帧#10:0x000000010c6d600e libswiftCore.dylib` Swift.Sequence.map((A.Element)throws->A1)throws->Swift.Array符合性Swift.LazyMapCollection:Swift.Sequence in Swift+78
帧#11:0x000000010c783347 libswiftCore.dylib`Swift.\u RandomAccessCollectionBox.\u映射((A.Element)抛出->A1)抛出->Swift.Array+135
帧#12:0x000000010CBDCAF PlaygroundLogger`\uuuuuuuuLLDB\uUnnamed\uSYMBOL270$$PlaygroundLogger+383
帧#13:0x000000010cbde62d PlaygroundLogger`uuuuuuuLLDB_unnamed_symbol284$$PlaygroundLogger+1357
帧#14:0x000000010cbdcd1a PlaygroundLogger`uuuuuuLLDB_unnamed_symbol270$$PlaygroundLogger+746
帧#15:0x000000010cbde62d PlaygroundLogger`uuuuuuuLLDB_unnamed_symbol284$$PlaygroundLogger+1357
帧#16:0x000000010cbdbc84 PlaygroundLogger`uuuuuuLLDB_unnamed_symbol258$$PlaygroundLogger+7460
帧#17:0x000000010cbd5752 PlaygroundLogger`uuuuuuLLDB_unnamed_symbol179$$PlaygroundLogger+114
帧#18:0x000000010cbd78e8 PlaygroundLogger`操场#日志#隐藏+264
帧#19:0x000000010d1e9427$uu lldb_expr10`主振荡器。xcplaygroundpage:16
帧#20:0x0000000108f881a0 com.apple.dt.Xcode.PlaygroundStub-macosx
帧#21:0x00007fff3643bf8c CoreFoundation`u_u调用u_u+140
帧#22:0x00007fff3643be5f CoreFoundation`-[NSInvocation invoke]+311
帧#23:0x00007fff3649d53d CoreFoundation`-[NSInvocation invokeWithTarget:+56
帧#24:0x00007fff5f53cbf5 ViewBridge`u 68-[NSVB\u ViewServiceImplicationDecodingProxy forwardInvocation:][u block\u invoke\u 2+46
帧#25:0x00007FFF501EC6 ViewBridge`-[NSViewServiceMarshall with HostWindowFrameAnimationProgress:perform::+53
帧#26:0x00007fff5f53cbbe ViewBridge`u 68-[NSVB\u ViewServiceImplicationDecodingProxy forwardInvocation:][u block\u invoke+113
帧#27:0x00007fff33a19731应用套件`+[NSAnimationContext runAnimationGroup:][55
帧#28:0x00007fff33a196e7 AppKit`+[NSAnimationContext runAnimationGroup:completionHandler:+82
帧#29:0x00007FFF55F154 ViewBridge`runAnimationGroup+295
帧#30:0x00007fff5f53c695视图桥`+[NSVB_视图_动画属性:动画:完成:]+490
帧#31:0x00007fff5f53cb28 ViewBridge`-[NSVB_ViewServiceImplicitationDecodingProxy forwardInvocation:+206
帧#32:0x00007fff3648580e CoreFoundation`\uuuuuuuuuuuuuuuuuuuuuuuuuu+780
帧#33:0x00007fff36485478 CoreFoundation`uuu转发u准备uu 0_uuu+120
帧#34:0x00007fff3643bf8c CoreFoundation`uu调用u u+140
帧#35:0x00007fff3643be5f CoreFoundation`-[NSInvocation invoke]+311
帧#36:0x00007fff3649d53d CoreFoundation`-[NSInvocation invokeWithTarget:+56
帧#37:0x00007FFF504973 ViewBridge`-[NSVB_QueueingProxy forwardInvocation:+324
帧#38:0x00007fff3648580e CoreFoundation`\uuuuuuuuuuuuuuuuuuuuuuuuuuu+780
帧#39:0x00007fff36485478 CoreFoundation`uuu转发u准备uu 0_uuu+120
帧#40:0x00007fff3643bf8c CoreFoundation`uuu调用uuu+140
帧#41:0x00007fff3643be5f CoreFoundation`-[NSInvocation invoke]+311
帧#42:0x00007fff3649d53d CoreFoundation`-[NSInvocation invokeWithTarget:+56
帧#43:0x00007fff3648580e CoreFoundation`uuuuuuuuu转发uuuuu+780
帧#44:0x00007fff36485478 CoreFoundation`uuu转发u准备uu 0_uuu+120
帧#45:0x00007fff3643bf8c CoreFoundation`u_u调用_u+140
帧#46:0x00007fff3643be5f CoreFoundation`-[NSInvocation invoke]+311
帧#47:0x00007fff5f4d16cd视图桥`\u延迟xpcinocationMainThread\u块\u调用+237
帧#48:0x00007fff5f4c6af3 ViewBridge`\uuuuWrapBlockWith凭单\uBlock\uInvoke+37
帧#49:0x00007fff5f4c68a4视图桥`\u延迟块到主线程\u块\u调用\u 2+553
帧#50:0x00007fff36469ca7 CoreFoundation`\uu CFRU