How can I access default iOS sound to set it as notification sound?

橙三吉。 提交于 2019-12-03 02:39:17
bitmapdata.com

check out this site.

If you want to play a Default System Sound. refer a following code, but private Frameworks. you will be rejected.

AudioServicesPlaySystemSound(1004);

and check out other this sample code (No private frameworks. supported a Apple).

System sounds are not available you your app, unfortunately. From the docs:

Note: System-supplied alert sounds and system-supplied user-interface sound effects are not available to your iOS application. For example, using the kSystemSoundID_UserPreferredAlert constant as a parameter to the AudioServicesPlayAlertSound function will not play anything.

Update

While Apple does say you can't access system sounds, I suppose they must mean that you can't access them for your own purposes, but I see that UILocalNotification.h provides:

UIKIT_EXTERN NSString *const UILocalNotificationDefaultSoundName; 

"Identifies the default system sound to play when a notification alert is displayed. You assign this value to the soundName property." I am now using this in my app and it seems to work fine.

user2212412

Audio services are not private. The methods are documented in the developers reference guide and referenced in the Multimedia Programming guide.

All you need to do if figure out the reference id of the sound you want to play.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!