0
創建應用程序的支持目錄URL當我寫這篇文章的代碼它的工作將無法爲CAF文件
NSString *recordFile = [NSTemporaryDirectory() stringByAppendingPathComponent: (NSString*)inRecordFile];
NSLog(@"////////////////////////// recordFile /////////////////////");
NSLog(recordFile) ;
url = CFURLCreateWithString(kCFAllocatorDefault, (CFStringRef)recordFile, NULL);
// create the audio file
XThrowIfError(AudioFileCreateWithURL(url, kAudioFileCAFType, &mRecordFormat, kAudioFileFlags_EraseFile,
&mRecordFile), "AudioFileCreateWithURL failed");
CFRelease(url);
,但是當我改變recordFile是這樣
NSString* Dpath ;
NSArray * paths;
// Build the Directory
paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
Dpath = [paths objectAtIndex:0];
Dpath = [DICOMpath stringByAppendingPathComponent:@"YYYYYYYYYYYY"];
Dpath = [DICOMpath stringByAppendingPathComponent:[FirstDirectory stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]] ;
Dpath = [DICOMpath stringByAppendingPathComponent:[SecondtDirectory stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]];
Dpath = [DICOMpath stringByAppendingPathComponent:@"XXX"];
NSString *recordFile = [Dpath stringByAppendingPathComponent:inRecordFile];
我看到消息AudioFileCreateWithURL失敗在控制檯中,我的代碼有什麼問題,確保我在第二個代碼中使用的路徑存在,並且工作,inRecordFile是caf文件名
您每次都從頭開始覆蓋'Dpath'值。這是你真正想要的嗎? – Costique 2012-02-21 09:49:39
是的我想獲得完整的路徑,在這個目錄中創建caf文件的問題 – AMH 2012-02-21 09:51:04