我在我的应用程序中使用SKStoreProductViewController
. 它显示正确,但有几秒钟的延迟,这会降低用户体验。
我的代码有问题吗?或者我应该通知用户 VC 正在加载?因为现在人们可以相信按下按钮后什么都没有发生(触发以下代码):
-(void)launchApp:(id)sender {
// Recall on main thread if necessary
if (![NSThread isMainThread]) {
[self performSelectorOnMainThread:@selector(launchApp:)
withObject:sender
waitUntilDone:NO];
return;
}
// Initialize Product View Controller
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
// Configure View Controller
[storeProductViewController setDelegate:self];
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @"*********"}
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];
}
}];
}