[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$fpUQu59MVhFzk7jVV2EPuZArffvUsNwgXYSAPwHy0iac":3},{"code":4,"message":5,"data":6},200,"成功",{"id":7,"createdAt":8,"title":9,"content":10,"summary":11,"image":12,"uid":13,"user":14,"categoryId":21,"category":22,"subCategoryId":24,"subCategory":25,"comments":27,"status":17,"reason":12,"notice":12,"visitCount":28,"commentCount":29,"keywords":30},74,"2024-02-02T11:18:28.84Z","iOS中录制音频的简单示例","直接看代码吧\n```\n\n// 音频文件目录\nNSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@\"Documents\"];\n\nNSString *folder = [path stringByAppendingString:@\"/Audio\"];\n    \nNSFileManager *fileManager = [NSFileManager defaultManager];\n    \nif(![fileManager fileExistsAtPath:folder]){ // 如果不存在，那么建立这个文件夹\n        \n        [fileManager createDirectoryAtPath:folder withIntermediateDirectories:YES attributes:nil error:nil];\n }\n// 时间戳\nNSDate *date = [NSDate date];\nNSInteger timeInterval = [date timeIntervalSince1970]*1000;    \nNSString *timeStamp = [NSString stringWithFormat:@\"%ld\", timeInterval];\n\n// 音频文件完整路径\nNSString *fileFullName = [NSString stringWithFormat:@\"%@.aac\", timeStamp];\nNSString *storePath = [path stringByAppendingPathComponent:fileFullName];\n\nNSError *error = nil;\n// 初始化录音机\nNSDictionary *setting = [NSDictionary\n                                                  dictionaryWithObjectsAndKeys:\n                                                  [NSNumber numberWithInt:kAudioFormatMPEG4AAC],AVFormatIDKey,\n                                                  [NSNumber numberWithInt:44100],AVSampleRateKey,\n                                                  [NSNumber numberWithInt:1],AVNumberOfChannelsKey,\n                                                  [NSNumber numberWithInt:16],AVLinearPCMBitDepthKey,\n                                                  [NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,\n                                                  [NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,\n                                                  nil];\n\n AVAudioRecorder *recorder = [[AVAudioRecorder alloc]\n                 initWithURL:[NSURL URLWithString:path]\n                 settings:setting\n                 error:&error];\n   \n  [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error: nil];\n    [[AVAudioSession sharedInstance] setActive: YES error: nil];\n    \n    AVAudioSession *session = [AVAudioSession sharedInstance];\n    NSError *setCategoryError = nil;\n    \n    if (![session setCategory:AVAudioSessionCategoryPlayAndRecord\n                  withOptions:AVAudioSessionCategoryOptionMixWithOthers\n                        error:&setCategoryError]) {\n        // handle error\n        NSLog(@\"Failed to setup audio session %@\", setCategoryError.description);\n        \n        if(callBack) {\n            \n            callBack(NO, 4, @\"录音链接建立失败\");\n        }\n    } else {\n        \n        if(callBack) {\n            \n            callBack(YES, 1, @\"录音链接建立成功\");\n        }\n        \n        [recorder prepareToRecord];\n        [recorder recordForDuration:audioMaxDuration];\n    }\n\n\n\n```","在iOS中如何手写一个录制音频的代码，一个简单的示例。","",499668042977349,{"phone":15,"userId":13,"nickName":16,"vipType":17,"avatar":18,"sign":19,"createdAt":20},"13121171998","全栈老韩",1,"https://image.xinwei.ltd/images/IMG_5430.JPG","全栈工程师，擅长iOS App开发、前端（vue、react、nuxt、小程序&Taro）开发、Flutter、React Native、后端（midwayjs、golang、express、koa）开发、docker容器、seo优化等。","2024-01-01T16:14:30.305Z",2,{"id":21,"name":23},"IT技术",3,{"id":24,"name":26,"parentId":21},"iOS",[],58,0,"ios,ios record,ios audio,ios音频,ios录制音频,ios开发"]