[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.
thanks -
Hi,
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.
@
-(void) playRingtone
{
SystemSoundID soundID;
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
-
That I don't know, you should read their documentation and try submitting. Worst case you have to do some rewrites and try again.