How to dispatch code blocks to the same thread in iOS?

前端 未结 8 1702
广开言路
广开言路 2021-01-31 11:04

Main aspect of the question: It\'s about iOS. Can I somehow dispatch code blocks in a way, that they will all (a) run in background and (b) on the same thread?

8条回答
  •  猫巷女王i
    2021-01-31 11:41

    You can use NSOperationQueue. You can make it use just one thread by using method - (void)setMaxConcurrentOperationCount:(NSInteger)count. Set it to 1

提交回复
热议问题