1

App Store からコンテンツをダウンロードすると、機能し始めて表示されます

進行状況: 0.000000

残り: -1.000000

進行状況: 0.000000

残り: -1.000000

進行状況: 0.750000

残り: 0.220680

最後に Failed と表示されます。

これは私が使用しているコードです

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
    for (SKPaymentTransaction * transaction in transactions) {
        switch (transaction.transactionState)
        {
            case SKPaymentTransactionStatePurchased:
                [[SKPaymentQueue defaultQueue] startDownloads:transaction.downloads];
                break;
            case SKPaymentTransactionStateFailed:
                [self failedTransaction:transaction];
                break;
            case SKPaymentTransactionStateRestored:
                [self restoreTransaction:transaction];
                break;
            default:
                break;
        }
    };
}

-(void) paymentQueue:(SKPaymentQueue *)queue updatedDownloads:(NSArray *)downloads
{
    for (SKDownload *download in downloads)
    {
        switch (download.downloadState)
        {
            case SKDownloadStateActive:
            {
                NSLog(@"progress: %f", download.progress);
                NSLog(@"%f remaining", download.timeRemaining);
                break;
            }

            case SKDownloadStateCancelled: { break; }
            case SKDownloadStateFailed:
            {
                NSLog(@"faild");
                break;
            }

            case SKDownloadStateFinished:
            {
                NSString *source = [download.contentURL relativePath];
                NSDictionary *dict = [[NSMutableDictionary alloc] initWithContentsOfFile:[source stringByAppendingPathComponent:@"ContentInfo.plist"]];

                NSLog(@"%@", dict); 

                [[SKPaymentQueue defaultQueue] finishTransaction:download.transaction];
                break;
            }

            case SKDownloadStatePaused:
            {
                NSLog(@"SKDownloadStatePaused");
                break;
            }

            case SKDownloadStateWaiting:
            {
                NSLog(@"SKDownloadStateWaiting");
                break;
            }
        }
    }

}

今すぐファイルを取得するにはどうすればよいですか?

4

0 に答える 0