Afnetworking: Xcode 9 warning: Unknown warning group '-Wreceiver-is-weak', ignored

Created on 13 Jun 2017  ยท  19Comments  ยท  Source: AFNetworking/AFNetworking

/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m:76:34: warning: unknown warning group '-Wreceiver-is-weak', ignored [-Wunknown-warning-option]
#pragma clang diagnostic ignored "-Wreceiver-is-weak"
                                 ^
/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m:97:34: warning: unknown warning group '-Wreceiver-is-weak', ignored [-Wunknown-warning-option]
#pragma clang diagnostic ignored "-Wreceiver-is-weak"
                                 ^
/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m:106:34: warning: unknown warning group '-Wreceiver-is-weak', ignored [-Wunknown-warning-option]
#pragma clang diagnostic ignored "-Wreceiver-is-weak"
                                 ^
3 warnings generated.

Most helpful comment

Since these warnings are only occurring in the UIKit subspec, they can be avoided by explicitly using only the NSURLSession subspec.

NSURLSession depends on all the other subspecs except UIKit, so most users can probably just change their Podfile to pod 'AFNetworking/NSURLSession'. Unless you actually use the UIKit extensions everything should just keep working.

All 19 comments

Update 2017-06-26

-Wreceiver-is-weak was removed from the AFNetworking code base on April 9, 2016, but there has yet to be a tagged release that includes these updates. It seems safe to remove the #pragma marks triggering the warning.


Xcode version

Version 9.0 beta 2 (9M137d)

Version of iOS or OS X you're targeting

iOS 8 ~ 11

The full output of any stack trace or compiler error

/path/to/project/libs/afnetworking3/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m:75:34: warning: unknown warning group '-Wreceiver-is-weak', ignored [-Wunknown-warning-option]
#pragma clang diagnostic ignored "-Wreceiver-is-weak"
                                 ^
/path/to/project/libs/afnetworking3/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m:95:34: warning: unknown warning group '-Wreceiver-is-weak', ignored [-Wunknown-warning-option]
#pragma clang diagnostic ignored "-Wreceiver-is-weak"
                                 ^
/path/to/project/libs/afnetworking3/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m:104:34: warning: unknown warning group '-Wreceiver-is-weak', ignored [-Wunknown-warning-option]
#pragma clang diagnostic ignored "-Wreceiver-is-weak"
                                 ^
3 warnings generated.

Any other details that would be useful in understanding the problem

The receiver-is-weak compiler warning is said here to have been removed from the clang codebase in favor of the "better" arc-repeated-use-of-weak warning; however, the date of this ticket is March 10th, 2015, which confuses me because we are just now seeing this.

Because arc-repeated-use-of-weak is a replacement for receiver-is-weak, and unknown-warning-option is simply a warning about an unknown compiler option, it may be safe to completely ignore this; however, if your customers demand "zero warnings" then this may need to be taken care of.

Sources:

Is a version with the updated code scheduled to come out prior to the Xcode 9 release?

Since these warnings are only occurring in the UIKit subspec, they can be avoided by explicitly using only the NSURLSession subspec.

NSURLSession depends on all the other subspecs except UIKit, so most users can probably just change their Podfile to pod 'AFNetworking/NSURLSession'. Unless you actually use the UIKit extensions everything should just keep working.

Fix coming up?

Came here to post this issue and saw it was already posted.

Taking into account that the last release is 80 commits away from master, it sounds about time a new tagged release is made with all these little improvements. Any plans on doing so @kcharwood @kylef & Company? ๐Ÿ™

Happy to help if required ๐Ÿ’ช ๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ

Come on, super man,answer the question.

Waiting for an answer

While waiting for the fix to be published I have forked the project and then started using my forked version of AFNetworking to continue working. Just change the pod declaration in your pod file.

pod 'AFNetworking', :git => 'https://github.com/<FORKING_ORG>/AFNetworking.git', :branch => '<BRANCH_NAME>'

Wait for the release here too.

Is this maintained at all anymore? Last commit is in July...

There are more warnings in Xcode 9.0.1

/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m:163:30: 'setResumingHandler:' is only available on iOS 9.0 or newer
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSProgress.h:150:35: 'setResumingHandler:' has been explicitly marked partial here
/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m:163:30: Enclose 'setResumingHandler:' in an @available check to silence this warning
/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m:181:32: 'setResumingHandler:' is only available on iOS 9.0 or newer
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSProgress.h:150:35: 'setResumingHandler:' has been explicitly marked partial here
/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m:181:32: Enclose 'setResumingHandler:' in an @available check to silence this warning

me too, Any one solved these warnings.

I'm going to try to get a release out soon.

yeeeeeeeears went by ...

We are waiting.

If you're using pods, I found an alternate solution

    pod 'AFNetworking', '3.1.0', :inhibit_warnings => true 

Cocoapods realizes that this is a thing. That consumers of a pod might not have control over the source. So by setting inhibit_warnings to true it will silence warnings on the pod when installing it. It doesn't remove the warning, but that was never my problem. I wanted my project down at 0 warnings. And now I have it and I continue to trust that the pod maintainer knows that these warnings may be safely ignored.

@dpfannenstiel why did I not know about this sooner. ๐Ÿ˜’ Thanks a ton.

The current release should have fixed this; please feel free to re-open if not.

Was this page helpful?
0 / 5 - 0 ratings