Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Simulator does not play sound

On XCode 6, everything works well on device, but on simulator, sound is not played.

There is my swift code :

var url =  NSURL(string: "http://my.url.com/sound.mp3")
var data = NSData(contentsOfURL: url!)
// Removed deprecated use of AVAudioSessionDelegate protocol
AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, error: nil)
AVAudioSession.sharedInstance().setActive(true, error: nil)
self.player = AVAudioPlayer(data: data, error: nil)
self.player.prepareToPlay()
self.player.delegate = self
self.player.volume = 1
self.player.play()

There is the log :

ERROR:     98: Error '!obj' trying to fetch default input device's sample rate

ERROR:     100: Error getting audio input device sample rate: '!obj'

WARNING:   230: The input device is 0x0; '(null)'

WARNING:   234: The output device is 0x26; 'AppleHDAEngineOutputDP:3,0,1,1:0:{2D4C-092D-00000000}'

ERROR:     400: error '!obj'

ERROR:     113: * * * NULL AQIONode object

ERROR:     180: EXCEPTION thrown ('!dev'): -

ERROR:     703: Can't make UISound Renderer

ERROR:     >aqsrv> 70: Exception caught in (null) - error -1

ERROR:     180: EXCEPTION thrown ('!dev'): -

ERROR:     >aqsrv> 70: Exception caught in (null) - error -1
like image 405
Kevin ABRIOUX Avatar asked Dec 12 '14 12:12

Kevin ABRIOUX


People also ask

How do I use voice over in iOS simulator?

While VoiceOver is not available directly in the Xcode simulator, it is possible to run VoiceOver from macOS to test your app. To do this, set keyboard focus on the simulator window then enable VoiceOver. From here you'll be able to use the Virtual Cursor to move between items on the screen.

Does Bluetooth Work on iOS simulator?

The simulator does support Bluetooth Low Energy (4.0) according to this appnote from Apple.


1 Answers

I was having this problem, the comment from @Matti Jokipii, helped me a lot.

You need to have a sound input enabled, so your Mac doesn't give you the null exception.
Go To System Preferences > Sound. And Check you have some input connected. If not, you will have to add a microfone, and re-rerun the app.

enter image description here

like image 193
Francisco Corrales Morales Avatar answered Nov 14 '22 16:11

Francisco Corrales Morales