NSData *data = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:onlinePath]];
if (!(data && data.length > 0)) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"获取网络语音失败!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alertView show];
[self performSelector:@selector(dismissAlertView:) withObject:alertView afterDelay:2.0f];
return;
}
[data writeToFile:localPath atomically:YES];
NSError *error;
NSURL *fileURL = [NSURL fileURLWithPath:localPath];
_audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error: &error];
_audioPlayer.delegate = self;