I've updated an existing project from RN 0.59 and RNS 0.10.12 to RN 0.61 and RNS 0.11. Now, sounds from bundle do not play on iOS.
I get the following error:
{
code : ENSOSSTATUSERRORDOMAIN-10875,
message : The operation couldn鈥檛 be completed. (OSStatus error -10875.),
domain : NSOSStatusErrorDomain,
userInfo : {
},
nativeStackIOS : [
0 My App
0x0000000104bb4760 RCTJSErrorFromCodeMessageAndNSError + 156,1 My App
0x0000000104bb4684 RCTJSErrorFromNSError + 264,2 My App
0x0000000104a7c900 -[RNSound prepare:withKey:withOptions:withCallback:] + 1600,3 CoreFoundation
0x00000001c5667c10 FF63481D-FB6A-353B-B2C1-AC4EAECF594D + 1252368,4 CoreFoundation
0x00000001c5537b00 FF63481D-FB6A-353B-B2C1-AC4EAECF594D + 6912,5 CoreFoundation
0x00000001c55386d8 FF63481D-FB6A-353B-B2C1-AC4EAECF594D + 9944,6 My App
0x0000000104b36e2c -[RCTModuleMethod invokeWithBridge:module:arguments:] + 1896,7 My App
0x0000000104b3a828 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 660,8 My App
0x0000000104b3a39c _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 144,9 My App
0x0000000104b3a300 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28,10 libdispatch.dylib
0x00000001061617fc _dispatch_call_block_and_release + 24,11 libdispatch.dylib
0x0000000106162bd8 _dispatch_client_callout + 16,12 libdispatch.dylib
0x0000000106169b48 _dispatch_lane_serial_drain + 744,13 libdispatch.dylib
0x000000010616a6e4 _dispatch_lane_invoke + 448,14 libdispatch.dylib
0x0000000106175adc _dispatch_workloop_worker_thread + 1324,15 libsystem_pthread.dylib
0x00000001c537ef88 _pthread_wqthread + 276,16 libsystem_pthread.dylib
0x00000001c5381ad4 start_wqthread + 8
]
}
Note that:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
var timerSound = new Sound("ring_bip.mp3",Sound.MAIN_BUNDLE,function(error,props) {
if(error == null) {
if(timerSound == null) {
return;
}
timerSound.setVolume(1.0);
timerSound.setNumberOfLoops(-1);
timerSound.play();
} else {
console.error(error);
}
});
the ring_bip.mp3 file is correctly added to the XCode project and attached to the main target
my target name does not have any space nor special character in its name
Is this a regression of react-native-sound ?
On the same ios version, RNS 0.10.12 was not having this problem...
Any help would be greatly appreciated.
Is your issue with...
Are you using...
react-native run-android)Which versions are you using?
Does the problem occur on...
If your problem is happening on a device, which device?
OK, for anyone having the same issue, in my info.plist, my Bundle name was set to $(PRODUCT_NAME) which indeed had a space in its value. You can check this value there.
I removed the space and it worked fine like before.
@zabojad I am having same problem but what if I want to release the app name with 2 words (contains space)?
Removing the spaces from my Target Name solved the issue , you can keep the display name with spaces that's not an issue
React Native : 0.59.10
react-native-sound : 0.11.0
Not being able to have a Display Name with a space in it seems like an annoying constraint and a bug (especially since this didn't use to be the case).
Edit: With further investigation I noticed that just setting "Bundle name" to a value without spaces seems to be enough. "Bundle display name" can still have spaces in it. You can set these values in your Info.plist file.
Just wrap basePath in encodeURIComponent and everything will work
var SOUND_PRESS = new Sound(getSoundName('sound_press'), encodeURIComponent(Sound.MAIN_BUNDLE));
Most helpful comment
Just wrap
basePathinencodeURIComponentand everything will work