[SOLVED] Play ios default ringtone
hi, I want to play and stop ios default rongtone programmatically in my ios application. I use qt5.4 in mac. Is there a objective_c native code to do that?
I do not want to use AudioServicesPlaySystemSound(1003) , because "undocumented enum values", that means i should not use it on AppStore apps.
I didn't test it but shouldn't you use AudioServicesCreateSystemSoundID with e.g. /System/Library/Audio/UISounds/dtmf-0.caf (see "here":https://theiphonewiki.com/wiki//System/Library/Audio/UISounds )to get the id and then play it ?
Hi, thank you for replying
I used this codes but nothing happens.
NSURL *fileURL = [NSURL URLWithString:@"/System/Library/Audio/UISounds/dtmf-0.caf"];
AudioServicesCreateSystemSoundID((__bridge_retained CFURLRef)fileURL , &soundID); AudioServicesPlaySystemSound(soundID);
You should check that AudioServicesCreateSystemSoundID doesn't return an error
I used AVAudioPlayer and now i can play iphone 4s default sounds. But how can i find default ringtone (user selected ringtone)? In my device, default ringtone is "Opening" but "/System/Library/Audio/UISounds/Opening.caf" play nothings.
I used this url: "/Library/Ringtones/Opening.m4r " and then played the ringtone with AVAudioPlayer. It works nice, but i want to know is it acceptable by app store? Because i want to add my application on apple app store.
That I don't know, you should read their documentation and try submitting. Worst case you have to do some rewrites and try again.