How to programmatically create an empty .m4a file of a certain length under iOS using CoreAudio on device?
问题 I need to create a dummy .m4a file of a certain length programatically under iOS... 回答1: try this NSError *error = nil; path = [path stringByAppendingPathComponent:@"tempfile"]; NSURL *URL = [NSURL fileURLWithPath:path]; [[NSFileManager defaultManager]createFileAtPath:path contents:nil attributes:nil] NSFileHandle *writeFile = [NSFileHandle fileHandleForWritingToURL:URL error:&error]; [writeFile truncateFileAtOffset:4000000000*sizeof(Byte)]; 来源: https://stackoverflow.com/questions/7011070/how