AdBase.m 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // AdBase.m
  3. // XenonSDK
  4. //
  5. // Created by fq on 2020/12/23.
  6. // Copyright © 2020 SAGESSE. All rights reserved.
  7. //
  8. #import "AdBase.h"
  9. @implementation AdBase
  10. - (instancetype)init
  11. {
  12. self = [super init];
  13. if (self) {
  14. self.adId = @""; //广告位名称
  15. self.medium = @""; //中介
  16. self.errorMsg = @""; //错误信息
  17. }
  18. return self;
  19. }
  20. //-(UIWindow*)currentWindow{
  21. // id appDelegate = [UIApplication sharedApplication].delegate;
  22. // if (appDelegate && [appDelegate respondsToSelector:@selector(window)]) {
  23. // return [appDelegate window];
  24. // }
  25. //
  26. //
  27. // NSArray *windows = [UIApplication sharedApplication].windows;
  28. // if ([windows count] == 1) {
  29. // return [windows firstObject];
  30. // } else {
  31. // for (UIWindow *window in windows) {
  32. // if (window.windowLevel == UIWindowLevelNormal) {
  33. // return window;
  34. // }
  35. // }
  36. // }
  37. //
  38. // return nil;
  39. //}
  40. //- (UIViewController *)currentViewController
  41. //{
  42. // UIWindow *window = [[UIApplication sharedApplication].delegate window];
  43. // UIViewController *topViewController = [window rootViewController];
  44. //
  45. // while (true) {
  46. //
  47. // if (topViewController.presentedViewController) {
  48. //
  49. // topViewController = topViewController.presentedViewController;
  50. //
  51. // } else if ([topViewController isKindOfClass:[UINavigationController class]] && [(UINavigationController*)topViewController topViewController]) {
  52. //
  53. // topViewController = [(UINavigationController *)topViewController topViewController];
  54. //
  55. // } else if ([topViewController isKindOfClass:[UITabBarController class]]) {
  56. //
  57. // UITabBarController *tab = (UITabBarController *)topViewController;
  58. // topViewController = tab.selectedViewController;
  59. //
  60. // } else {
  61. // break;
  62. // }
  63. // }
  64. // return topViewController;
  65. //}
  66. @end