Xcode 8 (beta 3) Warning: Ignoring return value of function declared with warn_unused_result attribute
After running Xcode 8 beta 3 and upgrading my project settings to the recommended settings as suggested by Xcode, I get 2 warnings: Ignoring return value of function declared with warn_unused_result attribute
These are in SRWebSocket.m (version 0.4.2), at lines:
- 501
- 1395
These lines both call SecRandomCopyBytes.
Any help is appreciated to resolve this.
This is fixed as of the current master and is the release coming soon.
Hi, can you give an estimate when the release will be?
I'm waiting for this too @nlutsenko is this ready?
👍
@nlutsenko Can you elaborate on what "coming soon" means? Almost 8 months have passed, and still the latest release is 0.4.2. What is the reason that 0.5.0 and 0.5.1 are present on https://github.com/facebook/SocketRocket/releases
Can 0.5.1 be used safely?
its still happends in Xcode 8.3
Same issue here. I can ask carthage to use the master branche of SocketRocket but that is actually not something I would like to have because it could break our code.
0.5.1 has the same issue for me,
Can you create a new version ?
As this is still not released, I decided to solve it myself in version 0.4.2.
Via a similar project of Facebook I found this thread: https://github.com/facebook/react-native/issues/8584 One of the comments refers to commit https://github.com/facebook/react-native/commit/2f788524112d59f62a295e7f4b0c1cfa0f6203fe
This shows the change in RCTSRWebSocket.m that can be used to solve these Xcode warnings in SRWebSocket.m.
Existing code
SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
Fix
int result = SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
assert(result == 0);
I silenced warnings in https://github.com/lookback/SocketRocket/commit/eb2b92e7e1ae95e339ac375dd60ae5146662a018 and published https://cocoapods.org/pods/SocketRocket_Lookback 0.5.2