Block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior

后端 未结 5 1764
无人及你
无人及你 2020-12-04 17:48

Given the following:

- (void) someMethod
{
    dispatch_async(dispatch_get_main_queue(), ^{
        myTimer = [NSTimer scheduledTimerWithTimeInterval: 60
            


        
5条回答
  •  孤街浪徒
    2020-12-04 18:13

    Recently I faced the same issue and @Vasily Bodnarchuk answer seems to be helpful.

    However in Continuous integration environments its not possible to change the CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF flag to NO at run time. So in order to isolate the issue i tried by checking all the dependent GEMS installed by Cocoapods and figured out that gem XCODEPROJ version 1.5.7 sets the CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF to YES whenever pod install command is executed. The solution for this is reverting the XCODEPROJ to earlier version 1.5.1 by executing sudo gem install xcodeproj -v 1.5.1 Once reverted just execute pod install and the flag will be set to NO always.

提交回复
热议问题