Question

I've just begun using CocoaPods today... First up I added AFNetworking, which worked fine... Then I needed SocketRocket...

However, SRWebSocket.m throws 9 warnings and 6 errors after being added with CocoaPods... The errors are in regards to retain/release not being available and ARC restrictions... The warnings are all:

'dispatch_get_current_queue' is deprecated: first deprecated in iOS 6.0

So I'm guessing I might be missing a step in setting this up somehow?

Any help would be appreciated...

Was it helpful?

Solution

So a couple things

  1. You should likely submit a pull request to SocketRocket to remove the usage of dispatch_get_current_queue and change it to whatever it was replaced with, but it is a warning so it's not a huge concern for now.

  2. Since the SocketRocket project does not support/utilize ARC (presumably since it is has retain/release calls in it) you will need to go into Build Phases > Compile Sources and locate all SocketRocket classes and add the -fno-objc-arc compiler flag. This will let you compile, ideally though the SkyRocket Podspec should be updated to specify that ARC should be turned off. The compiler_flags property in the Podspec should include -fno-objc-arc, you should submit a pull request to have that updated.

EDIT

Interestingly SocketRocket touts that it uses ARC and I do not see any calls to retain/release (outside of CFRetain/CFRelease, which is fine/necessary in ARC).

I took a peak at the source code for SRWebSocket.m for both versions that are listed in the podspec repo (0.1.0 and 0.2.0) neither have retain/release calls.

0.2.0: https://github.com/square/SocketRocket/blob/v0.2.0/SocketRocket/SRWebSocket.m

0.1.0: https://github.com/square/SocketRocket/blob/82c9f8938f8b9b7aa578866cb7ce56bc11e52ced/SocketRocket/SRWebSocket.m

Strange?? Are you sure you are getting errors about SRWebSocket.m?

EDIT 2

After further digging and as mentioned in the comments. dispatch_release and dispatch_retain are not allowed when targeting iOS 6.0+ or OS X 10.8+ so you will need to remove those calls or do something that was suggested in pull request 55 for the project

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top