当我尝试显示另一个窗口时,我从Main.storyboard加载windowController并从MiaPlayerViewController.xib加载viewController;
我的这段代码在调试环境下运行良好,
当由OS X 10.13.x的设备归档时,也可以,
但是当我通过OS X 10.14.4的设备归档此代码时,它就会崩溃。
// MiaPlayerWindowController is a NSWindowController
// MiaPlayerViewController is a NSViewController
public class func windowController() -> MiaPlayerWindowController {
let storyboard = NSStoryboard(name: "Main", bundle: nil)
guard let wc = storyboard.instantiateController(withIdentifier: "MiaPlayerWindowController") as? MiaPlayerWindowController else {
NSLog("Error")
return MiaPlayerWindowController()
}
let player = MiaPlayerViewController()
// code is ok by here
wc.contentViewController = player // <- crash here
wc.window?.animationBehavior = .none
return wc
}
一些崩溃报告在这里
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000630ca32d4400
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [97135]
VM Regions Near 0x630ca32d4400:
MALLOC_NANO (reserved) 0000600008000000-0000600020000000 [384.0M] rw-/rwx SM=NUL reserved VM address space (unallocated)
-->
STACK GUARD 0000700007a87000-0000700007a88000 [ 4K] ---/rwx SM=NUL stack guard for thread 1
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff78404d5c objc_release + 28
1 com.apple.CoreFoundation 0x00007fff4c261424 __CFBasicHashDrain + 359
2 com.apple.CoreFoundation 0x00007fff4c39105e _CFRelease + 239
3 com.apple.Foundation 0x00007fff4e5fa8c8 -[NSKeyedUnarchiver dealloc] + 397
4 libobjc.A.dylib 0x00007fff78405c8c (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 726
5 com.apple.CoreFoundation 0x00007fff4c25fe06 _CFAutoreleasePoolPop + 22
6 com.apple.Foundation 0x00007fff4e60ca5e -[NSAutoreleasePool drain] + 144
7 com.apple.AppKit 0x00007fff497d7267 -[NSApplication run] + 957
8 com.apple.AppKit 0x00007fff497c68a3 NSApplicationMain + 780
9 com.miamusic.mialive.mac 0x0000000100d50d09 main + 9
10 libdyld.dylib 0x00007fff794dfed9 start + 1
TIA为您提供帮助...