【发布时间】:2015-11-06 08:59:02
【问题描述】:
我正在尝试使用 Apple Watch Simulator(Watch OS 2 beta)创建音频录制功能。但是在调用 presentAudioRecorderControllerWithOutputURL 时出现以下错误。
错误:错误域=com.apple.watchkit.errors Code=3 "(null)"
-(void)didSelectRowWithTag:(NSInteger)tag
{
NSString*strPath = [NSSearchPathForDirectoriesInDomains(NSDocumentationDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *strAudioFileName = [strPath stringByAppendingString:[NSString stringWithFormat:@"/%d.caf",tag]];
NSURL *urlOutPut = [NSURL fileURLWithPath:strAudioFileName];
NSDictionary *dictMaxAudioRec = @{@"WKAudioRecorderControllerOptionsMaximumDurationKey":@1800};
[self presentAudioRecorderControllerWithOutputURL:urlOutPut preset:WKAudioRecorderPresetHighQualityAudio options:dictMaxAudioRec completion:^(BOOL didSave, NSError * error) {
if(didSave)
{
NSLog(@"File Saved....");
}
NSLog(@"%@",error);
}];
}
【问题讨论】:
-
如果您将文件格式从“.caf”更改为“.wav”、“.mp4”或“.m4a”,如@lostAtSeaJoshua 所述
标签: objective-c watchkit audio-recording simulator apple-watch