IOS开发之_本地音乐,录音,打包测试程序,本地通知;

/*使用OC的AVFoundataion播放本地音乐

 *掌握AVAudioPlayer用于播放音频文件

 *掌握本地音乐播放时的音量与速度的控制

*/

步骤

1导入AVFoundataion头文件

2初始化AVAudioPlayer用于播放音频文件

3播放、停时播放音频文件,"停时,音频播放的位置该回状态"

4设置音频的播放'currentTime'

5设置音频的播放速度'rate',"设置速度一定要设置AVAudioPlayer的enableRate

6设置音频的播放次numberOfLoops,//0一次,1代表两次,以

7设置AVAudioPlayer的代方法,eg.结束、开始中结束

8在ios8中使用通知听音频播放的中

NSNotificationCenter center = [NSNotificationCenter defaultCenter] AVAudioSession *session = [AVAudioSession sharedInstance];

[center addObserver: self selector:@selector(handleInterruption:) name:

AVAudioSessionInterruptionNotification object: session];

/*

* 实现音,只需要使用AVFoundation的AVAudioRecorder

*/

步骤

1实现界面排版,按钮要实现件的听TouchDown/TouchUpInside/TouchUpOutSide 2初始化音器AVAudioRecorder

设置文件保存路径

设置录配置

/*

//音频码格式
settin
gs[AVFormatIDKey] = @(kAudioFormatAppleIMA4); //音频采样
settings[AVSampleRateKey] = @(8000.0);
//音频频
settings[AVNumberOfChannelsKey] = @(1); //音频线性音频的位深度 settings[AVLinearPCMBitDepthKey] = @(8);
*/

3准备录音,准备工作 4开始

5结束录 6录音时间短,使用AVAudioPlayer

7刷新

8播放

"怎么把应用程序打包成一个ipa"

回顾真机调用的步骤
1.装一个开发者证书,让电脑具有真机调式的功能
2.在后台,生成一个bundle ID
3.在后台添加手机的UUID
4.生成一个描述文件


打包应用程序(testaa)
1.装一个证书,打包的证书
2.生成一个bundle ID('cn.itcast.testaa')
3.添加手机UUID(客户必须给我们手机UUID)
4.生成一个描述文件
  •
xcode里打包应用程序的时候,输入帐号,xcode会自动帮你生成描述文件

5.利用xcode打包应用程序

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   
if([UIDevice currentDevice].systemVersion.doubleValue >= 8.0 ){
       
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
        [application
registerUserNotificationSettings:settings];
        [application
registerForRemoteNotifications];
    }
else{
        [application
registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];
    }
   
if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
       
//
    }
   
return YES;
}
- (
void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
   
NSLog(@"%@",deviceToken.description);
}
- (
void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
   
NSLog(@"%@",userInfo);

}


你可能感兴趣的:(IOS开发之_本地音乐,录音,打包测试程序,本地通知;)