Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Check if the delegate responds to the methods. #93

Merged
merged 1 commit into from

2 participants

@fernandonf

Otherwise you get a runtime error if a delegate was set but doesn't
implement them. Those methods are optional in the protocol.

@fernandonf fernandonf Check if the delegate responds to the methods.
Otherwise you get a runtime error if a delegate was set but doesn't
implement them. Those methods are optional in the protocol.
baf4ce2
@ngreenstein
Collaborator

Good catch. Thanks!

@ngreenstein ngreenstein merged commit b4f34d1 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 14, 2013
  1. @fernandonf

    Check if the delegate responds to the methods.

    fernandonf authored
    Otherwise you get a runtime error if a delegate was set but doesn't
    implement them. Those methods are optional in the protocol.
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 2 deletions.
  1. +6 −2 Appirater.m
View
8 Appirater.m
@@ -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];
}
Something went wrong with that request. Please try again.