SocketRocket icon indicating copy to clipboard operation
SocketRocket copied to clipboard

Xcode 8 (beta 3) Warning: Ignoring return value of function declared with warn_unused_result attribute

Open funnel20 opened this issue 10 years ago • 9 comments

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.

funnel20 avatar Jul 21 '16 11:07 funnel20

This is fixed as of the current master and is the release coming soon.

nlutsenko avatar Jul 21 '16 20:07 nlutsenko

Hi, can you give an estimate when the release will be?

funnel20 avatar Sep 09 '16 08:09 funnel20

I'm waiting for this too @nlutsenko is this ready?

pablogeek avatar Sep 19 '16 18:09 pablogeek

👍

ykokw avatar Sep 21 '16 05:09 ykokw

@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?

funnel20 avatar Mar 15 '17 14:03 funnel20

its still happends in Xcode 8.3

RoeeNadam avatar Apr 06 '17 07:04 RoeeNadam

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 ?

SjoerdPerfors avatar Aug 22 '17 10:08 SjoerdPerfors

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);

funnel20 avatar Sep 01 '17 13:09 funnel20

I silenced warnings in https://github.com/lookback/SocketRocket/commit/eb2b92e7e1ae95e339ac375dd60ae5146662a018 and published https://cocoapods.org/pods/SocketRocket_Lookback 0.5.2

nevyn-lookback avatar Jun 20 '18 13:06 nevyn-lookback