0
我下載的歌曲與asihttp要求 我的問題是,當我在URL點擊下載歌曲,歌曲開始在我看來打 如何停止這個,我不想首歌應該玩的時候下載 請幫助停止背景音樂播放時,歌曲下載的iPhone
我下載的歌曲與asihttp要求 我的問題是,當我在URL點擊下載歌曲,歌曲開始在我看來打 如何停止這個,我不想首歌應該玩的時候下載 請幫助停止背景音樂播放時,歌曲下載的iPhone
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];
您不需要下載與ASIHTTPRequest一首歌,因爲ASIHTTPRequest沒有支持在所有播放歌曲。你究竟在做什麼?向我們展示一些代碼。 – JosephH