ASIHTTPREQUESTを使用してデバイスがスリープモードに移行するときに、INAPP購入のダウンロードを維持する方法の問題で誰かが私を助けることができるかどうか疑問に思います。アプリで購入してダウンロードする音楽ファイルを含むアプリケーションを実行しましたが、たとえば、アルバムを購入してダウンロードを開始します。たとえば、彼の電話がスリープ状態になると、ダウンロードが停止します!!! よろしくお願いします。
-(void) downloadAlbum:(NSNumber *)Albumid {
//NSLog(@"%@",Albumid);
//myTable.scrollEnabled = NO;
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
if (CurrentSongID<=CurrentAlbumCount) {
if (isDownload==FALSE) {
Reachability* internetReach = [[Reachability reachabilityForInternetConnection] retain];
[internetReach startNotifier];
NetworkStatus netStatus = [internetReach currentReachabilityStatus];
switch (netStatus)
{
case NotReachable:
{ UIAlertView *someError = [[UIAlertView alloc] initWithTitle: @"Top 10" message: @"Check Internet Connectivity" delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[someError show];
[someError release];
break;
}
case ReachableViaWWAN:
{
}
case ReachableViaWiFi:
{ NSString *DestinationFileName= [self FileNameGetter:Albumid FileID:CurrentSongID ];
NSString * URL=[NSString stringWithFormat: @"http://core-4.doubleu.mobi/cdownload/%@/%d.mp3",[self AlbumNameGetter:Albumid],CurrentSongID];
isDownload=TRUE;
progressIndicator.hidden=FALSE;
DownloadedFileName.hidden=FALSE;
NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"Albums" ofType:@"plist"];
contentArray=[NSMutableArray arrayWithContentsOfFile:plistPath];
//NSLog(@"%@",contentArray);
DownloadedFileName.text=[NSString stringWithFormat:@"%d/%d",CurrentSongID ,CurrentAlbumCount];//[CurrentAlbum count]];
if (!networkQueue) {
networkQueue = [[ASINetworkQueue alloc] init];
}
failed = NO;
[networkQueue setDownloadProgressDelegate:progressIndicator];
[networkQueue setRequestDidFinishSelector:@selector(nextDownload)];
[networkQueue setShowAccurateProgress:YES];
[networkQueue setDelegate:self];
request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:URL]];
[request setDownloadDestinationPath:[[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"]
stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.mp3",[self FileNameGetter:Albumid FileID:CurrentSongID ]]]];
[networkQueue addOperation:request];
[networkQueue go];
break;
}
}
}
else {
UIAlertView *someError = [[UIAlertView alloc] initWithTitle: @"Top 10" message: @"Please wait Until download Completed" delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[someError show];
[someError release];
}
}
else {
//NSString *DestinationFileName= [self FileNameGetter:NSCurrentAlbumID FileID:CurrentSongID ];
//myTable.scrollEnabled = YES;
switch (CurrentAlbumIDd) {
//to be modified
case 1:
{
//NSString *DestinationFileName= [self FileNameGetter:NSCurrentAlbumID FileID:CurrentSongID ];
UIAlertView *someError = [[UIAlertView alloc] initWithTitle: @"فضل شاكر" message:[NSString stringWithFormat:@"Download بياع القلوب Completed"] delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[someError show];
[someError release];
//[Album1 setTag:Album1.tag*100];
downloaded1 = TRUE;
available1=1;
break;}
case 2:
{
UIAlertView *someError = [[UIAlertView alloc] initWithTitle: @"فضل شاكر" message:[NSString stringWithFormat:@"Download الحب القديم Completed"] delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[someError show];
[someError release];
// [Album2 setTag:Album2.tag*100];
downloaded2 = TRUE;
available2=1;
break;
}
case 3:
{
UIAlertView *someError = [[UIAlertView alloc] initWithTitle: @"فضل شاكر" message:[NSString stringWithFormat:@"Download حبك خيال Completed"] delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[someError show];
[someError release];
// [Album3 setTag:Album3.tag*100];
downloaded3 = TRUE;
available3=1;
break;
}