SKStoreProductViewController showing up with delay

后端 未结 1 1975
没有蜡笔的小新
没有蜡笔的小新 2020-12-29 15:22

I use in my app the SKStoreProductViewController. It shows up correctly, but with a few seconds of delay, which slows down the user experience.

Is there

相关标签:
1条回答
  • 2020-12-29 16:03

    The delay is caused because you present the viewController after the products have been loaded sucesfully.

    You can put the call presentViewController:animated:completion: outside of the block that is called after the products have been loaded. In this case the controller will be presented empty, and it is filled after the products have been loaded.

    Something along those lines:

    SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
    
    // Configure View Controller
    [storeProductViewController setDelegate:self];
    [storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @364709193}
                                          completionBlock:^(BOOL result, NSError *error) {
        if (error) {
            NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
        } else {
    
        }
    }];
    // Present Store Product View Controller
    [self presentViewController:storeProductViewController animated:YES completion:nil];
    

    Or you could create a "popup" view that shows an activity indicator while the controller loads its content.

    Or you use [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

    There are a couple of ways to handle this.

    0 讨论(0)
提交回复
热议问题