Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions MLeaksFinder/MLeaksMessenger.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

#import "MLeaksMessenger.h"

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000
static __weak UIAlertView *alertView;
#else
static __weak UIAlertView *alertView;
#endif

@implementation MLeaksMessenger

Expand All @@ -25,13 +29,27 @@ + (void)alertWithTitle:(NSString *)title
delegate:(id<UIAlertViewDelegate>)delegate
additionalButtonTitle:(NSString *)additionalButtonTitle {
[alertView dismissWithClickedButtonIndex:0 animated:NO];
UIAlertView *alertViewTemp = [[UIAlertView alloc] initWithTitle:title
message:message
delegate:delegate
cancelButtonTitle:@"OK"
otherButtonTitles:additionalButtonTitle, nil];
[alertViewTemp show];
alertView = alertViewTemp;
if (@available(iOS 9, *)) {
UIAlertController * alertViewTemp = [UIAlertController
alertControllerWithTitle:title
message:message
preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
//do something when click button
}];
[alertViewTemp addAction:okAction];
[[[[UIApplication sharedApplication] keyWindow] rootViewController] presentViewController:alertViewTemp animated:YES completion:nil];
}
else{
UIAlertView *alertViewTemp = [[UIAlertView alloc] initWithTitle:title
message:message
delegate:delegate
cancelButtonTitle:@"OK"
otherButtonTitles:additionalButtonTitle, nil];
[alertViewTemp show];
alertView = alertViewTemp;
}

NSLog(@"%@: %@", title, message);
}
Expand Down