Repository navigation
Open
Labels
Description
πͺ² Description
Compilation error when building iOS project.
πͺ² What is the observed behavior?
The build fails with the following error:
β (/node_modules/react-native-sound/ios/RNSound.mm:180:73)
178 | #pragma mark - Audio Control Methods
179 |
> 180 | RCT_EXPORT_METHOD(prepare:(NSString *)fileName key:(double)key options:(JS::NativeSoundIOS::SoundOptionTypes &)options callback:(RCTResponseSenderBlock)callback ) {
| ^ use of undeclared identifier 'JS'
181 | NSError *error;
182 | NSURL *fileNameUrl;
183 | AVAudioPlayer *player;
β (/node_modules/react-native-sound/ios/RNSound.mm:180:73)
178 | #pragma mark - Audio Control Methods
179 |
> 180 | RCT_EXPORT_METHOD(prepare:(NSString *)fileName key:(double)key options:(JS::NativeSoundIOS::SoundOptionTypes &)options callback:(RCTResponseSenderBlock)callback ) {
| ^ expected a type
181 | NSError *error;
182 | NSURL *fileNameUrl;
183 | AVAudioPlayer *player;πͺ² What is the expected behavior?
The library should compile successfully on iOS.
πͺ² Please post your code:
Sound.setCategory('Alarm', true);
const alarm = new Sound(
'critical_notification.mp3',
Sound.MAIN_BUNDLE,
error => {
if (error) {
console.log('Failed to load the sound', error);
return;
}
alarm.play(success => {
if (success) {
console.log('Successfully finished playing');
} else {
console.log('Playback failed due to audio decoding errors');
}
});
}
);π‘ Is there a workaround?
Not a long-term solution that I am aware of.
π‘ If the bug is confirmed, would you be willing to create a pull request?
Yes, I can help if guidance is provided.
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.13.0
- React Native: 0.76.9
- iOS:
- Android:
- Windows:
Does the problem occur on...
- Simulator
- Device
If your problem is happening on a device, which device?
- Device: iPhone 14
Reacted by KubilayKartega, Prateek Thapa and Christian Schmidt
Activity
pSapien commentedon Dec 10, 2025
@vitoriamacena did you find any fix to this issue?
vitoriamacena commentedon Dec 10, 2025
No, I ended up adding it to my
react-native.config.jsthen use only for Android.abdulmateen-pb commentedon Jan 14, 2026
The current release destroying everything ios build is never successful just waiting for the stable release please release stable version,
dubiao commentedon Mar 10, 2026
try this:
find the
prepare: fileNamefunction innode_modules/react-native-sound/ios/RNSound.mm, and replace it withI am running on Old Arch, and dont have JS in runtime. This fix it to dict type for
options.chichilatte commentedon May 27, 2026
We had the same problem with react-native-sound, having turned off new architecture in our project until the react-native-firebase packages catch up.
The solution was to add this to the
ios/Podfile...Actually, we're using expo, so had to implement this solution as an
app.jsonplugin so that it could survive prebuild cleans (they wipe theiosfolder).Note: The above code was generated by DeepSeek, so ymmv. Works for us!