diff --git a/SimpleSurvey/Simple Survey/ViewController.m b/SimpleSurvey/Simple Survey/ViewController.m index eaf4615..e67fe79 100644 --- a/SimpleSurvey/Simple Survey/ViewController.m +++ b/SimpleSurvey/Simple Survey/ViewController.m @@ -14,7 +14,7 @@ //Set to Angry Birds 2 -- change to your app #define APP_ID @"880047117" -@interface ViewController () +@interface ViewController () @property (nonatomic, strong) SMFeedbackViewController * feedbackController; @property (weak, nonatomic) IBOutlet UIButton *takeSurveyButton; @property (weak, nonatomic) IBOutlet UILabel *statusLabel; @@ -74,29 +74,38 @@ - (void)respondentDidEndSurvey:(SMRespondent *)respondent error:(NSError *) erro } -#pragma mark - UIAlertViewDelegate -- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex -{ - if (buttonIndex == 0) - { - } - else if(buttonIndex == 1) - { - NSString *appStoreURL = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id%@?mt=8", APP_ID]; - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:appStoreURL]]; - } -} - - (void) showAlertWithBody:(NSString *)body hasRateButton:(BOOL)hasRateButton { - UIAlertView * alert =[[UIAlertView alloc ] initWithTitle:NSLocalizedString(@"Thanks for your feedback!", @"Heading for feedback prompt") - message:body - delegate:self - cancelButtonTitle: NSLocalizedString(@"Cancel", @"Title of cancel button on app store rating prompt") - otherButtonTitles: nil]; + + UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Thanks for your feedback!", @"Heading for feedback prompt") + message:body + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction* cancel = [UIAlertAction + actionWithTitle:NSLocalizedString(@"Cancel", @"Title of cancel button on app store rating prompt") + style:UIAlertActionStyleCancel + handler:^(UIAlertAction * action) + { + // Respond to cancel button press. + }]; + + UIAlertAction* rate = [UIAlertAction + actionWithTitle:NSLocalizedString(@"Rate Us", @"Title of rate us button on app store rating prompt") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) + { + // Respond to rate button press. + // (Note: This url will not open on a simulator. It must be run on a physical device.) + NSString *appStoreURL = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/apple-store/id%@", APP_ID]; + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:appStoreURL] options:@{} completionHandler:nil]; + }]; + + [alertController addAction: cancel]; + if (hasRateButton) { - [alert addButtonWithTitle:NSLocalizedString(@"Rate Us", @"Title of rate us button on app store rating prompt")]; + [alertController addAction: rate]; } - [alert show]; + + [self presentViewController:alertController animated:YES completion:nil]; } @end diff --git a/SurveyMonkeyiOSSDK.framework/Versions/A/Headers/SMFeedbackViewController.h b/SurveyMonkeyiOSSDK.framework/Versions/A/Headers/SMFeedbackViewController.h index f41916c..7d690bd 100644 --- a/SurveyMonkeyiOSSDK.framework/Versions/A/Headers/SMFeedbackViewController.h +++ b/SurveyMonkeyiOSSDK.framework/Versions/A/Headers/SMFeedbackViewController.h @@ -5,10 +5,10 @@ #import #import #import "SMRespondent.h" -#define GIVE_FEEDBACK NSLocalizedString(@"Give Feedback", @"Title for primary action button for intercept UIAlertView") -#define NOT_NOW NSLocalizedString(@"Not Now", @"Title for negative action button for intercept UIAlertView") -#define DEFAULT_ALERT_TITLE NSLocalizedString(@"Enjoying the %@ app?", @"Title for intercept UIAlertView") -#define DEFAULT_ALERT_BODY NSLocalizedString(@"Take our quick feedback survey and let us know how we're doing.", @"Body for intercept UIAlertView") +#define GIVE_FEEDBACK NSLocalizedString(@"Give Feedback", @"Title for primary action button for intercept UIAlertController") +#define NOT_NOW NSLocalizedString(@"Not Now", @"Title for negative action button for intercept UIAlertController") +#define DEFAULT_ALERT_TITLE NSLocalizedString(@"Enjoying the %@ app?", @"Title for intercept UIAlertController") +#define DEFAULT_ALERT_BODY NSLocalizedString(@"Take our quick feedback survey and let us know how we're doing.", @"Body for intercept UIAlertController") /** * The FeedbackDelegate protocol defines the methods a delegate of a SMFeedbackViewController object should implement. @@ -97,24 +97,24 @@ @property (nonatomic, strong) UIColor * cancelButtonTintColor; /** - * Display the intercept UIAlertView to the user - asking them to give feedback on your app. - * By default, the UIAlertView prompt will display 3 days after app install. If the user declines to take the survey, they will be prompted again in 3 weeks. + * Display the intercept UIAlertController to the user - asking them to give feedback on your app. + * By default, the UIAlertController prompt will display 3 days after app install. If the user declines to take the survey, they will be prompted again in 3 weeks. * If the user consents to take the survey, they'll be prompted again in 3 months. * * @param viewController The view controller from which to launch the SMFeedbackViewController - * @param appTitle The title of your app -- used in the title of the UIAlertView (e.g. Are you enjoying the [App Title] app?) + * @param appTitle The title of your app -- used in the title of the UIAlertController (e.g. Are you enjoying the [App Title] app?) */ -(void)scheduleInterceptFromViewController:(UIViewController *)viewController withAppTitle:(NSString *)appTitle; /** - * Display the intercept UIAlertView to the user - asking them to give feedback on your app. - * Supply an alert title and body for the UIAlertView prompt, as well as time intervals (in seconds) to wait before displaying the prompt (i.e. after app install, after consents to take the survey, and after the user declines to take the survey) + * Display the intercept UIAlertController to the user - asking them to give feedback on your app. + * Supply an alert title and body for the UIAlertController prompt, as well as time intervals (in seconds) to wait before displaying the prompt (i.e. after app install, after consents to take the survey, and after the user declines to take the survey) * * @param viewController The view controller from which to launch the SMFeedbackViewController - * @param alertTitle The title of the UIAlertView prompt - * @param alertBody The body of the UIAlertView prompt - * @param positiveActionTitle The title of the positive action button on the UIAlertView prompt - * @param cancelTitle The title of the cancel button on the UIAlertView prompt + * @param alertTitle The title of the UIAlertController prompt + * @param alertBody The body of the UIAlertController prompt + * @param positiveActionTitle The title of the positive action button on the UIAlertController prompt + * @param cancelTitle The title of the cancel button on the UIAlertController prompt * @param afterInstallInterval The amount of time (in seconds) to delay before first prompting the user to give feedback after they install your app. * @param afterAcceptInterval The amount of time (in seconds) to wait before prompting the user to give feedback again after they consent to take your survey. * @param afterDeclineInterval The amount of time (in seconds) to wait before prompting the user to give feedback again after they decline to take your survey. diff --git a/SurveyMonkeyiOSSDK.framework/Versions/A/SurveyMonkeyiOSSDK b/SurveyMonkeyiOSSDK.framework/Versions/A/SurveyMonkeyiOSSDK index 3355f17..e78c523 100644 Binary files a/SurveyMonkeyiOSSDK.framework/Versions/A/SurveyMonkeyiOSSDK and b/SurveyMonkeyiOSSDK.framework/Versions/A/SurveyMonkeyiOSSDK differ diff --git a/surveymonkey-ios-sdk.podspec b/surveymonkey-ios-sdk.podspec index 1176d68..4f956d2 100644 --- a/surveymonkey-ios-sdk.podspec +++ b/surveymonkey-ios-sdk.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "surveymonkey-ios-sdk" - s.version = "2.0.6" + s.version = "2.0.7" s.summary = "The SurveyMonkey Mobile Feedback SDK for iOS" s.homepage = "https://github.com/SurveyMonkey/surveymonkey-ios-sdk" s.license = 'MIT'