iOS - 系统提醒短音频
Demo下载地址
iPhone端系统Audio资源路径:/System/Library/Audio/UISounds
首先,通过 NSFileManager 获取资源路径下的所有路径(文件夹/文件)
NSFileManager * fileManager = [NSFileManager defaultManager];
NSURL * _soundDataURL = [NSURL URLWithString:@"/System/Library/Audio/UISounds"];
NSDirectoryEnumerator * _soundDirectoryEnum = [fileManager enumeratorAtURL:_soundDataURL
includingPropertiesForKeys:@[NSURLIsDirectoryKey]
options:0
errorHandler:^BOOL(NSURL * _Nonnull url, NSError * _Nonnull error) {
return YES;
}];
接着遍历枚举,然后获取系统音频的SoundID:
/*!
@typedef SystemSoundID
@abstract SystemSoundIDs are created by the System Sound client application
for playback of a provided AudioFile.
*/
typedef UInt32 SystemSoundID;
通过使用 AudioServicesCreateSystemSoundID 方法:
/*!
@function AudioServicesCreateSystemSoundID
@abstract Allows the application to designate an audio file for playback by the System Sound server.
@discussion SystemSoundIDs are used passed to
AudioServicesPlayAlertSound() & AudioServicesPlaySystemSound(),
designating the audio data to be played by the System Sound server.
@param inFileURL
A CFURLRef for an AudioFile.
@param outSystemSoundID
Returns a SystemSoundID.
*/
extern OSStatus
AudioServicesCreateSystemSoundID( CFURLRef inFileURL,
SystemSoundID* outSystemSoundID)
获取SoundID后,最后,使用 AudioServicesPlaySystemSound 播放这个SoundID 音频:
AudioServicesPlaySystemSound(SystemSoundID inSystemSoundID)
iOS - 系统提醒短音频的更多相关文章
- IOS 掉用系统发短信
#import <MessageUI/MessageUI.h> MFMessageComposeViewControllerDelegate #pragma mark - 调用ios系统短 ...
- iOS 系统架构
https://developer.apple.com/library/ios/documentation/Miscellaneous/Conceptual/iPhoneOSTechOverview/ ...
- 深入了解ios系统机制
1.什么叫ios? ios一般指ios(Apple公司的移动操作系统) . 苹果iOS是由苹果公司开发的移动操作系统.苹果公司最早于2007年1月9日的Macworld大会 ...
- iOS音频学习笔记二:iOS SDK中与音频有关的相关框架
上层: Media Player Framework: 包含MPMoviePlayerController.MPMoviePlayerViewController.MPMusicPla ...
- iOS 用户体验之音频
早期某知名公司的应用有这么一个问题,如果我在听音乐时打开该应用,播放一段小视频,视频播放完成之后,音乐没有继续播放.这个问题被很多用户吐槽,很久以后,该公司终于修复了这个问题. 无论声音是应用体验的重 ...
- 认识iOS系统架构
关于本文: 文章主要介绍iOS系统架构中的四层结构的内容.常用的框架.大致的功能,然后对iOS开发人员的发展提出自己的一些拙见. 一.iOS系统是基于UNIX系统,所有从系统稳定性上来说的确比其他操作 ...
- iOS系统架构
1.iOS系统架构 iOS的系统架构分为四个层次 核心操作系统层 (Core OS) 它包括 内存管理 , 文件系统 , 电源管理以及一些其他的操作系统任务, 它可以直接和硬件设备进行交互 核心服务层 ...
- IOS系统框架
IOS系统框架:ios架构号MAC OS的基础框架相似:ios扮演底层硬件和应用程序的中介,底层为所有应用程序提供基础服务,高层则包含一些复杂巧妙的技术和服务,并且创建的应用程序不能直接访问硬件. C ...
- iOS系统及客户端软件测试的基础介绍
iOS系统及客户端软件测试的基础介绍 iOS现在的最新版本iOS5是10月12号推出,当前版本是4.3.5 先是硬件部分,采用iOS系统的是iPad,iPhone,iTouch这三种设备,其中iPho ...
随机推荐
- 集合2--毕向东java基础教程视频学习笔记
Day14 08 LinkedList09 LinkedList练习10 ArrayList练习11 ArrayList练习2 12 HashSet13 HashSet存储自定义对象14 HashSe ...
- mac brew & gcc安装
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ...
- Oracle system identifier(SID) "xxx" alread exits. Specify another SID
案例环境: 操作系统 :Oracle Linux Server release 5.7 64 bit 数据库版本:Oracle Database 10g Release 10.2.0.4.0 - ...
- SQL SERVER 重组含有特殊字符的索引时遇到“关键字 'with' 附近有语法错误.”
案例描述 这是在索引重组过程中遇到的有意思的错误案例,搜索了一下也没有看到相关资料,估计我第一个碰到这类错误的人(It's just a joke).具体情况是YourSQLDba在做维护数据库索引时 ...
- springMVC基础controller类
此文章是基于 搭建SpringMVC+Spring+Hibernate平台 功能:设置请求.响应对象:session.cookie操作:ajax访问返回json数据: 创建springMVC基础con ...
- jquery选择器案例
一.预期效果 实现一个效果,如下. 品牌列表默认精简显示,单击“显示全部品牌”按钮显示全部品牌,同时列表将推荐的品牌的名字高亮显示,按钮里的文字变成“精简显示品牌”.再次点击“精简显示品牌”回到初始页 ...
- ZBrush中该如何调节多个SubTool
我们学习了人体的基本雕刻,了解了人体结构.比例.骨骼.肌肉对于人物模型雕刻的重要性.本节课对ZBrush中的"Transpose Master"功能进行讲解,这个插件是ZBrush ...
- MIT 6.824 : Spring 2015 lab3 训练笔记
摘要: 源代码参见我的github:https://github.com/YaoZengzeng/MIT-6.824 Lab3: Paxos-based Key/Value Service Intro ...
- IIS上部署Net.Core
部署: 1.安装vc_redist.x64vc_redist.x64 2.安装DotNetCore.1.0.0.RC2-WindowsHosting 3.安装DotNetCore.1.0.0-SDK. ...
- 将“早期版本的Windows”改名
将“早期版本的Windows”改名,并修改系统等待时间 问题描述: 先装Windows XP,再装Windows 7,启动菜单会出现“早期版本的Windows”与“Windows 7”两个 ...