react-native-sound icon indicating copy to clipboard operation
react-native-sound copied to clipboard

Update import format to XCode 14.2 compat

Open NaeemCheema opened this issue 2 years ago • 0 comments

:beetle: Description

The import #import "RCTUtils.h" in /RNSound/RNSound.m is causing issues in XCode 14.2. It looks like the same issue as this expo issue: https://github.com/expo/expo/issues/15622#issuecomment-997141629

For us, the expo workaround https://github.com/expo/expo/pull/15655 with expo_patch_react_imports isn't consistently working, so it would be great to change the import into #import <React/RCTUtils.h>.

Is that an option? Would you accept a PR for that?

:beetle: What is the observed behavior?

:beetle: What is the expected behavior?

:beetle: Please post your code:

This patch works for us:
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;

:bulb: Does the problem have a test case?

:bulb: Possible solution

:bulb: Is there a workaround?

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

Is your issue with...

  • [x] iOS
  • [x] Android
  • [ ] Windows

Are you using...

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

Which versions are you using?

  • React Native Sound:
  • React Native:
  • iOS:
  • Android:
  • Windows:

Does the problem occur on...

  • [x] Simulator
  • [x] Device

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

  • Device:

NaeemCheema avatar Mar 14 '23 11:03 NaeemCheema