React-native-sound: [iOS][0.11] ENSOSSTATUSERRORDOMAIN-10875 after update to React native 0.61 and react-native-sound 0.11

Created on 14 Nov 2019  路  5Comments  路  Source: zmxv/react-native-sound

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:

  • I do have this in my info.plist:
    <key>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
  • the js code that plays the sound has not changed at all after the update from RNS 0.10.12 to 0.11:
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...

  • [X] iOS

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: 0.11
  • React Native: 0.61.4
  • iOS: 13

Does the problem occur on...

  • [X] Device

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

  • Device: all iphone and ipads
question

Most helpful comment

Just wrap basePath in encodeURIComponent and everything will work

var SOUND_PRESS = new Sound(getSoundName('sound_press'), encodeURIComponent(Sound.MAIN_BUNDLE));

All 5 comments

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));
Was this page helpful?
0 / 5 - 0 ratings