一、GCDAsyncSocket的核心就是dispatch_source_set_event_handler 1.accpet回调 accept4Source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, socket4FD, 0, socketQueue); int socketFD = socket4FD; dispatch_source_t acceptSource = accept4Source; dispatch_source_set_event_handler(accept4Source, ^...
dispatch_source_set_event_handler Sets the event handler block for the given dispatch source. iOS 4.0+iPadOS 4.0+Mac Catalyst 13.1+macOS 10.6+tvOS 9.0+visionOS 1.0+watchOS 2.0+ voiddispatch_source_set_event_handler(dispatch_source_tsource,dispatch_block_thandler); ...
.setEventHandler(handler:{DispatchQueue.main.async{}})sourceTimer?.resume()} 暂时的解决办法:调用定时器的创建开启时给0.1S的延时 funcopenTimer(){cancelTimer()DispatchQueue.main.asyncAfter(deadline:.now()+0.1){self.startTimer()}}
Dispatch dispatch_source_set_event_handler Function Sets the event handler block for the given dispatch source. iOS 4.0+iPadOS 4.0+Mac Catalyst 13.1+macOS 10.6+tvOS 9.0+visionOS 1.0+watchOS 2.0+ voiddispatch_source_set_event_handler(dispatch_source_tsource,dispatch_block_thandler); ...
dispatch_source_set_event_handler Sets the event handler block for the given dispatch source. iOS 4.0+iPadOS 4.0+Mac Catalyst 13.1+macOS 10.6+tvOS 9.0+visionOS 1.0+watchOS 2.0+ voiddispatch_source_set_event_handler(dispatch_source_tsource,dispatch_block_thandler); ...
Sets the event handler block for the given dispatch source. iOS 4.0+iPadOS 4.0+Mac Catalyst 13.1+macOS 10.6+tvOS 9.0+visionOS 1.0+watchOS 2.0+ void dispatch_source_set_event_handler(dispatch_source_t source, dispatch_block_t handler);
Dispatch Source Creating a Dispatch Source dispatch_source_create T dispatch_source_t T dispatch_source_type_t Managing Event Handlers dispatch_source_set_registration_handler_f dispatch_source_set_registration_handler dispatch_source_set_event_handler_f dispatch_source_set_event_handler ...
dispatch_source_set_event_handler_f Sets the event handler function for the given dispatch source. iOS 4.0+iPadOS 4.0+Mac Catalyst 13.1+macOS 10.6+tvOS 9.0+visionOS 1.0+watchOS 2.0+ voiddispatch_source_set_event_handler_f(dispatch_source_tsource,dispatch_function_thandler); ...