Nothing prints out in the console in command line tool Xcode

妖精的绣舞 提交于 2019-11-29 17:01:39

Applications – such has command-line programs – which do not already have a "run loop" have to call

dispatch_main() // Swift 2
dispatchMain()  // Swift 3

in order to use GCD. From the documentation:

This function "parks" the main thread and waits for blocks to be submitted to the main queue. Applications that call UIApplicationMain (iOS), NSApplicationMain (Mac OS X), or CFRunLoopRun on the main thread must not call dispatch_main.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!