2011-10-03 3 views
0
에서 노래 다운로드

내가 asihttp 요청에 노래를 다운로드하고 때 내 문제가 내가이 정지 어떻게, 내가해야 노래를 돼요 ASIHTTPRequest 전혀 노래를 재생에 대한 지원이 없습니다로 를 다운로드하는 것은, 당신은 ASIHTTPRequest와 노래를 다운로드하지 않을정지 배경 음악 재생 아이폰

+0

제발 도와주세요하면 재생할 수 있습니다. 너 뭐하니? 몇 가지 코드를 보여주십시오. – JosephH

답변

0
obj.tagvalue=[sender tag]; 
NSString * tmp =[NSString stringWithString:[obj.ringArray objectAtIndex:obj.tagvalue]]; 
NSString *filename=[RingUrlArray objectAtIndex:obj.tagvalue]; 
NSLog(@"%@",filename); 


NSURL *url=[NSURL URLWithString:tmp]; 
NSLog(@"url %@",url); 
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; 

NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; 



NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"Song"]; 

if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath]) 
    [[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:nil]; 

NSString *filePath =[NSString stringWithFormat:@"%@/%@.mp3",dataPath,filename]; 

NSLog(@"%@",filePath); 
[request setDownloadDestinationPath:filePath]; 
[request startAsynchronous]; 

UIAlertView *v=[[UIAlertView alloc] initWithTitle:@"Download Message " message:@"Your download has been started" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
[v show]; 
[v release];