SKStoreProductViewController display apps from developer

余生颓废 提交于 2019-12-10 13:48:26

问题


i'm using SKStoreProductViewController to implement "more apps" functionality, but when I tap on a product on the list, i'm getting only blank screen, there is also a warning in console:

Could not request view controller: Error Domain=_UIViewServiceInterfaceErrorDomain Code=2 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 2.)"

this happens only on ios 7, in ios 6 it simply redirects to app store, here is my code:

SKStoreProductViewController *productVC = [[SKStoreProductViewController alloc] init];
productVC.delegate = self;
NSDictionary *productParameters = @{ SKStoreProductParameterITunesItemIdentifier :  <itunes developer ID>};
[productVC loadProductWithParameters:productParameters completionBlock:^(BOOL result, NSError *error) {
    if(error)
    {
       [[UIAlertView alloc] initWithTitle:[error localizedDescription]
                                                            message:nil
                                                           delegate:nil
                                                  cancelButtonTitle:@"Ok"
                                                  otherButtonTitles:nil, nil] show];


    }

    if (result )
    {
        [self presentViewController:productVC animated:NO completion:nil];
    }

}];

i think this is ios 7 bug, any help greatly appricated


回答1:


This is a bug in iOS 7. See https://devforums.apple.com/message/951745 (requires Apple dev login) where an Apple employee confirms that "The SKSPVC does not support this currently. It currently only supports showing an individual product."

Pretty annoying, since this used to work great and was a great way for a company to show users its other apps. Back to the drawing board!




回答2:


If you are using simulator, Inapp purchases (storekit) will not work in ios7 but only ios6.

Check here - How to test IAP (in-app purchase) in iOS Simulator OR on the Device?



来源:https://stackoverflow.com/questions/20675880/skstoreproductviewcontroller-display-apps-from-developer

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