Compiler gives warning on performSelectorOnMainThread:@selector(delegateMethod)

后端 未结 4 2052
渐次进展
渐次进展 2021-01-05 02:29

I have an NSOperation that wraps some web service functionality. The NSOperation has a delegate that is to be messaged when the operation is over.

As the NSOperation

4条回答
  •  囚心锁ツ
    2021-01-05 02:45

    1) Declare your delegate's protocol to extend the NSObject protocol in the .h file

    @protocol YourDelegateProtocol 
    

    2) Cast to NSObject in your call

    [(NSObject*)delegate performSelectorOnMainThread:@selector(getDealersIDSuccess:) withObject:result waitUntilDone:YES];
    

    I definitely recommend number (1).

提交回复
热议问题