我正在开发一个应用程序,在该应用程序中,我们通过使用TFHpple解析其HTML内容从UIwebview中选择mp3 URL。 mp3网址是编码网址,即它们包含%20而不是空格。当我尝试使用ASIHttpRequest下载该mp3文件时,它会导致请求失败。请帮帮我
我使用的代码:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"MyFolder"];
NSError *error = nil;
if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
[[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:&error];
dwnldSongWebservice = [[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:SONG_URL_2]];
[dwnldSongWebservice setDownloadDestinationPath:[NSString stringWithFormat:@"%@/sample.mp3",dataPath]];
[dwnldSongWebservice setDelegate:self];
[dwnldSongWebservice startAsynchronous];