完整報錯
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!' terminating with uncaught exception of type NSException
原因
所有AppKit / GUI調用都需要在主線程中進行,無法在其他線程執行。
解決辦法
在主線程執行代碼,如果該代碼在其他子線程當中,則可以用dispatch_async(dispatch_get_main_queue(), ^{})方法調起主線程,將代碼寫在其中