SKStoreProductViewControllerDelegate 方法未被调用
SKStoreProductViewControllerDelegate method not being called
我只是想在我的应用程序中实现 iTunes 商店屏幕,它可以正确显示。然而,当用户完成屏幕(进行购买或点击 'cancel')时,我得到的只是一个白屏,我必须完全关闭我的应用程序并重新打开它。
原来我的 productViewControllerDidFinish
方法没有被调用。
我有一个具有 SKStoreProductViewControllerDelegate 的 table 视图控制器,我在同一个 class 中显示和关闭商店视图,那么为什么不调用委托方法?
- (void)toStore:(Button*)sender {
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @"stuff"} completionBlock:^(BOOL result, NSError *error) {
if (error) {
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
} else {
[self presentViewController:storeProductViewController animated:YES completion:nil];
}
}];
}
- (void)productViewControllerDidFinish:(SKStoreProductViewController*)viewController {
[self dismissViewControllerAnimated:YES completion:nil];
}
两者都在 UITableViewController 中。提前致谢!
设置 SKStoreProductViewController 控制器的委托..你错过了..
将其设置在对象分配的下方..
storeProductViewController.delegate = self;
我只是想在我的应用程序中实现 iTunes 商店屏幕,它可以正确显示。然而,当用户完成屏幕(进行购买或点击 'cancel')时,我得到的只是一个白屏,我必须完全关闭我的应用程序并重新打开它。
原来我的 productViewControllerDidFinish
方法没有被调用。
我有一个具有 SKStoreProductViewControllerDelegate 的 table 视图控制器,我在同一个 class 中显示和关闭商店视图,那么为什么不调用委托方法?
- (void)toStore:(Button*)sender {
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @"stuff"} completionBlock:^(BOOL result, NSError *error) {
if (error) {
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
} else {
[self presentViewController:storeProductViewController animated:YES completion:nil];
}
}];
}
- (void)productViewControllerDidFinish:(SKStoreProductViewController*)viewController {
[self dismissViewControllerAnimated:YES completion:nil];
}
两者都在 UITableViewController 中。提前致谢!
设置 SKStoreProductViewController 控制器的委托..你错过了..
将其设置在对象分配的下方..
storeProductViewController.delegate = self;