Crash with [UIAlertController dismissWithClickedButtonIndex:animated:]: unrecognized selector sent to instance [Fix provided]
nickbit opened this issue · comments
Nikos Bitoulas commented
Hi Arash,
Crash occurs in Appirater.m:570
- (void)hideRatingAlert {
if ([self isRatingAlertVisible]) {
if (_debug)
NSLog(@"APPIRATER Hiding Alert");
[self.ratingAlert dismissWithClickedButtonIndex:-1 animated:NO];
}
}
Reason is that dismissWithClickedButtonIndex:animated
is valid for UIAlertView but not for UIAlertController.
Here is a fix:
- (void)hideRatingAlert {
if ([self isRatingAlertVisible]) {
if (_debug)
NSLog(@"APPIRATER Hiding Alert");
if ([self.ratingAlert respondsToSelector:@selector(dismissWithClickedButtonIndex:animated:)]) {
[self.ratingAlert dismissWithClickedButtonIndex:-1 animated:NO];
} else {
[self.ratingAlert dismissViewControllerAnimated:NO completion:nil];
}
}
}
jamescahall commented
I've received crash alerts for the same issue. Please fix.
jamescahall commented
Nickbit, do you have a fork for this? We really need to get this fix out to users right away as its affecting a ton of users on apps.
Arash Payan commented
Thank you for the diagnosis and solution @nickbit. @jamescahall, I'll be releasing an update with this fix in an hour or two.
Arash Payan commented
I released this in 2.3.1.