{"record":{"id":"3528bec9ff35f091","repo":"libgdx/libgdx","slug":"ios-audio-is-not-enabled-by-the-application-config-3528be","errorCode":null,"errorMessage":"iOS audio is not enabled by the application config","messagePattern":"iOS audio is not enabled by the application config","errorType":"exception","errorClass":"GdxRuntimeException","httpStatus":null,"severity":"error","filePath":"backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/DisabledIOSAudio.java","lineNumber":30,"sourceCode":"\t@Override\n\tpublic void didBecomeActive () {\n\t}\n\n\t@Override\n\tpublic void willEnterForeground () {\n\t}\n\n\t@Override\n\tpublic void willResignActive () {\n\t}\n\n\t@Override\n\tpublic void dispose () {\n\t}\n\n\t@Override\n\tpublic AudioDevice newAudioDevice (int samplingRate, boolean isMono) {\n\t\tthrow new GdxRuntimeException(\"iOS audio is not enabled by the application config\");\n\t}\n\n\t@Override\n\tpublic AudioRecorder newAudioRecorder (int samplingRate, boolean isMono) {\n\t\tthrow new GdxRuntimeException(\"iOS audio is not enabled by the application config\");\n\t}\n\n\t@Override\n\tpublic Sound newSound (FileHandle fileHandle) {\n\t\tthrow new GdxRuntimeException(\"iOS audio is not enabled by the application config\");\n\t}\n\n\t@Override\n\tpublic Music newMusic (FileHandle file) {\n\t\tthrow new GdxRuntimeException(\"iOS audio is not enabled by the application config\");\n\t}\n\n\t@Override","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/libgdx/libgdx/blob/97f40861878058087be0685ca167ddfde132134b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/DisabledIOSAudio.java#L12-L48","documentation":"DisabledIOSAudio is the no-op Audio implementation installed when the RoboVM application config leaves audio disabled. Its newAudioDevice throws GdxRuntimeException because there is no real audio hardware binding to back an AudioDevice.","triggerScenarios":"Calling Gdx.audio.newAudioDevice(samplingRate, isMono) on iOS when the IOSApplicationConfiguration / RoboVM bootstrap did not enable audio, so the DisabledIOSAudio stub is wired in.","commonSituations":"Disabling audio for faster startup or because background-audio entitlements are missing; then a shared code path (desktop-tested) still calls newAudioDevice for microphone/PCM output features.","solutions":["Enable audio in the iOS application configuration used to bootstrap the RoboVM application so the real ObjectAL audio implementation is installed.","Guard cross-platform audio-recording/playback features behind a capability check (e.g. platform constant) so iOS-with-audio-disabled builds skip them.","Wrap the call in try/catch GdxRuntimeException and disable the PCM audio feature gracefully."],"exampleFix":"// before\nAudioDevice device = Gdx.audio.newAudioDevice(44100, false); // throws when audio disabled\n\n// after\ntry {\n    AudioDevice device = Gdx.audio.newAudioDevice(44100, false);\n} catch (GdxRuntimeException e) {\n    Gdx.app.error(\"Audio\", \"newAudioDevice unavailable (audio disabled in iOS config)\");\n}","handlingStrategy":"validation","validationCode":"if (Gdx.app.getType() != ApplicationType.iOS || audioEnabledInConfig) {\n    device = Gdx.audio.newAudioDevice(44100, false);\n}","typeGuard":null,"tryCatchPattern":"try { Gdx.audio.newAudioDevice(...); } catch (GdxRuntimeException e) { /* PCM output unsupported here */ }","preventionTips":["Enable audio in the iOS app config if any audio API is used","Gate PCM features behind platform checks","Log Gdx.audio class at startup to confirm the real implementation is bound"],"tags":["libgdx","ios","robovm","audio","configuration"],"backgroundTag":null,"analyzedSha":"97f40861878058087be0685ca167ddfde132134b","analyzedAt":"2026-08-14T10:52:53.492Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}