Permalink
Browse files

Merge pull request #93 from fernandonf/master

Check if the delegate responds to the methods.
  • Loading branch information...
ngreenstein committed Jan 14, 2013
2 parents e999b69 + baf4ce2 commit b4f34d12050222e846333b1c90ea7e5b1347b916
Showing with 6 additions and 2 deletions.
  1. +6 −2 Appirater.m
View
@@ -385,7 +385,9 @@ + (void)rateApp {
NSNumber *appId = [NSNumber numberWithInteger:_appId.integerValue];
[storeViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:appId} completionBlock:nil];
storeViewController.delegate = self.sharedInstance;
- [self.sharedInstance.delegate appiraterWillPresentModalView:self.sharedInstance animated:_usesAnimation];
+ if ([self.sharedInstance.delegate respondsToSelector:@selector(appiraterWillPresentModalView:animated:)]) {
+ [self.sharedInstance.delegate appiraterWillPresentModalView:self.sharedInstance animated:_usesAnimation];
+ }
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:storeViewController animated:_usesAnimation completion:^{
[self setModalOpen:YES];
//Temporarily use a black status bar to match the StoreKit view.
@@ -453,7 +455,9 @@ + (void)closeModal {
BOOL usedAnimation = _usesAnimation;
[self setModalOpen:NO];
[[UIApplication sharedApplication].keyWindow.rootViewController dismissViewControllerAnimated:_usesAnimation completion:^{
- [self.sharedInstance.delegate appiraterDidDismissModalView:(Appirater *)self animated:usedAnimation];
+ if ([self.sharedInstance.delegate respondsToSelector:@selector(appiraterDidDismissModalView:animated:)]) {
+ [self.sharedInstance.delegate appiraterDidDismissModalView:(Appirater *)self animated:usedAnimation];
+ }
}];
[self.class setStatusBarStyle:(UIStatusBarStyle)nil];
}

0 comments on commit b4f34d1

Please sign in to comment.