Just retain a reference to that view controller in your view controller:
@property (nonatomic, strong) UIViewController * skStoreProductViewController;
Then create the product view controller:
// Probably in -viewDidLoad ?
if (param != nil && NSClassFromString(@"SKStoreProductViewController"))
{
self.skStoreProuctViewController = [[SKStoreProductViewController alloc] init];
// etc...
}
Now, when the user backgrounds your app there is a notification for that event that you can listen for in your view controller. Set up a selector to run and use it to dismiss your view controller:
// Probably in -viewDidLoad
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(shouldDismiss:) name:UIApplicationDidEnterBackgroundNotification object:nil];
Then ...
- (void)shouldDismiss:(NSNotification*)notification {
[self.skStoreProductViewController dismissViewControllerAnimated:YES completion:nil]
}