-
Notifications
You must be signed in to change notification settings - Fork 780
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
KubilayKartega and pSapien