I seen games like Kingdom Clash Castle Story
being able to launch AppStore within their game without minimizing their game. The AppStore page will just slide in from bottom, show a game page, and players can download that game, key in their password, close the page and they are still in the game.
Is there a way to do this? I can only minimize my own app, and open the Appstore.
Please advise. Thanks
You can use SKStoreProductViewController class
Import StoreKit framework
#import <StoreKit/StoreKit.h>
Implement the SKStoreProductViewControllerDelegate
@interface MyViewControllerClass : NSObject <SKStoreProductViewControllerDelegate> {
}
- (void) openAppStore
{
if( NSStringFromClass([SKStoreProductViewController class]) != nil )
{
SKStoreProductViewController *viewCont = [[SKStoreProductViewController alloc] init];
viewCont.delegate = self;
[viewCont loadProductWithParameters:[NSDictionary dictionaryWithObject:@"APP_ID_FROM_ITUNES" forKey:SKStoreProductParameterITunesItemIdentifier] completionBlock:nil];
[self.navigationController presentViewController:viewCont animated:YES completion:nil];
}
else
{
// open safari
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/us/app/facebook/id284882215?mt=8"]];
}
}
// SKStoreProductViewControllerDelegate
-(void)productViewControllerDidFinish:(SKStoreProductViewController *)productViewController
{
[productViewController dismissViewControllerAnimated:YES completion:nil];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.