NSUInteger len = [response length];
Byte *byteData = (Byte *)malloc(len);
memcpy(byteData, [response bytes], len);
NSData *soundData = [NSData dataWithBytes:byteData length:len];
NSString *soundFilePath = [NSString stringWithFormat:@"%@/%@", [self documentDirectory], OWAudioDoorKeyFileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:soundFilePath]) {
[[NSFileManager defaultManager] removeItemAtPath:soundFilePath
error:nil];
}
[[NSFileManager defaultManager] createFileAtPath:soundFilePath
contents:soundData
attributes:nil];
这是我的代码,但该文件无法播放 请帮助,提前致谢。