SKStoreProductViewController showing up with delay

痞子三分冷 提交于 2019-11-30 05:30:22

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!