MLeaksMessenger.m 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * Tencent is pleased to support the open source community by making MLeaksFinder available.
  3. *
  4. * Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
  5. *
  6. * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
  7. *
  8. * https://opensource.org/licenses/BSD-3-Clause
  9. *
  10. * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  11. */
  12. #import "MLeaksMessenger.h"
  13. static __weak UIAlertView *alertView;
  14. @implementation MLeaksMessenger
  15. + (void)alertWithTitle:(NSString *)title message:(NSString *)message {
  16. [self alertWithTitle:title message:message delegate:nil additionalButtonTitle:nil];
  17. }
  18. + (void)alertWithTitle:(NSString *)title
  19. message:(NSString *)message
  20. delegate:(id<UIAlertViewDelegate>)delegate
  21. additionalButtonTitle:(NSString *)additionalButtonTitle {
  22. [alertView dismissWithClickedButtonIndex:0 animated:NO];
  23. UIAlertView *alertViewTemp = [[UIAlertView alloc] initWithTitle:title
  24. message:message
  25. delegate:delegate
  26. cancelButtonTitle:@"OK"
  27. otherButtonTitles:additionalButtonTitle, nil];
  28. [alertViewTemp show];
  29. alertView = alertViewTemp;
  30. NSLog(@"%@: %@", title, message);
  31. }
  32. @end