zmxv / react-native-sound

React Native module for playing sound clips

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[iOS] Can't build with react-native 0.67.4

aprilmintacpineda opened this issue · comments

🪲 Description

I'm trying to build with react-native 0.67.4 bare react-app on iOS but it always fails with the following errors:

node_modules/react-native-sound/RNSound/RNSound.m:236:44: Implicit declaration of function 'RCTJSErrorFromNSError' is invalid in C99
node_modules/react-native-sound/RNSound/RNSound.m:236:44: Declaration of 'RCTJSErrorFromNSError' must be imported from module 'React.RCTUtils' before it is required
node_modules/react-native-sound/RNSound/RNSound.m:236:44: Conflicting types for 'RCTJSErrorFromNSError'

It works fine with android though.

XCode: Version 13.3 (13E113)

🪲 What is the observed behavior?

Build fails when building for ios.

🪲 What is the expected behavior?

It should not fail building.

🪲 Please post your code:

N/A

💡 Does the problem have a test case?

💡 Possible solution

💡 Is there a workaround?

💡 If the bug is confirmed, would you be willing to create a pull request?

Is your issue with...

  • iOS
  • Android
  • Windows

Are you using...

  • React Native CLI (e.g. react-native run-android)
  • Expo
  • Other: (please specify)

Which versions are you using?

  • React Native Sound: 0.11.2
  • React Native: 0.67.4
  • iOS: 12
  • Android:
  • Windows:

Does the problem occur on...

  • Simulator
  • Device

If your problem is happening on a device, which device?

  • Device: N/A

Possible workaround:

Applying the following patch, works:

diff --git a/node_modules/react-native-sound/RNSound/RNSound.m b/node_modules/react-native-sound/RNSound/RNSound.m
index df3784e..17e5894 100644
--- a/node_modules/react-native-sound/RNSound/RNSound.m
+++ b/node_modules/react-native-sound/RNSound/RNSound.m
@@ -1,10 +1,5 @@
 #import "RNSound.h"
-
-#if __has_include("RCTUtils.h")
-#import "RCTUtils.h"
-#else
 #import <React/RCTUtils.h>
-#endif
 
 @implementation RNSound {
     NSMutableDictionary *_playerPool;