AppDelegate.m 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. //
  2. // AppDelegate.m
  3. // NatureDemo
  4. //
  5. // Created by SAGESSE on 2019/1/20.
  6. // Copyright © 2019 SAGESSE. All rights reserved.
  7. //
  8. #import "AppDelegate.h"
  9. #import <FBSDKCoreKit/FBSDKCoreKit.h>
  10. #import <FBSDKLoginKit/FBSDKLoginKit.h>
  11. #import "XenonSDK.h"
  12. #import "MLAdManager.h"
  13. @interface AppDelegate ()
  14. @end
  15. @implementation AppDelegate
  16. //#define T_FOREACH_ARGC_(_0,_1,_2,_3,_4,_5,_6,_7,N,...) N
  17. //#define T_FOREACH_ARGC(...) T_FOREACH_ARGC_(0, ##__VA_ARGS__, 7,6,5,4,3,2,1,0)
  18. //
  19. //#define T_FOREACH_1(F,N,_1) F(_1)
  20. //#define T_FOREACH_2(F,N,_1,_2) T_FOREACH_1(F,N,_1) N F(_2)
  21. //#define T_FOREACH_3(F,N,_1,_2,_3) T_FOREACH_2(F,N,_1,_2) N F(_3)
  22. //#define T_FOREACH_4(F,N,_1,_2,_3,_4) T_FOREACH_3(F,N,_1,_2,_3) N F(_4)
  23. //#define T_FOREACH_5(F,N,_1,_2,_3,_4,_5) T_FOREACH_4(F,N,_1,_2,_3,_4) N F(_5)
  24. //#define T_FOREACH_6(F,N,_1,_2,_3,_4,_5,_6) T_FOREACH_5(F,N,_1,_2,_3,_4,_5) N F(_6)
  25. //#define T_FOREACH_7(F,N,_1,_2,_3,_4,_5,_6,_7) T_FOREACH_6(F,N,_1,_2,_3,_4,_5,_6) N F(_7)
  26. //
  27. //#define T_FOREACH_CONCAT_(A, B) A ## B
  28. //#define T_FOREACH_CONCAT(A, B) T_FOREACH_CONCAT_(A, B)
  29. //
  30. //#define T_FOREACH(F, N, ...) T_FOREACH_CONCAT(T_FOREACH_, T_FOREACH_ARGC(__VA_ARGS__))(F, N, __VA_ARGS__)
  31. //
  32. //#define T_FORMATS_U(P) @#P"=%@"
  33. //#define T_FORMATS(...) T_FOREACH(T_FORMATS_U, ", ", ##__VA_ARGS__)
  34. //
  35. //#define T(...) NSLog(@"%s " T_FORMATS(__VA_ARGS__), __func__, __VA_ARGS__)
  36. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  37. // Override point for customization after application launch.
  38. //1.facebook SDK init
  39. // [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
  40. // NSLog(@"%s %@", __func__, [(id)(NSClassFromString(@"XCBundle") ?: NSBundle.mainBundle) bundlePath]);
  41. // T(self, application, launchOptions);
  42. //
  43. [XenonSDK.sharedSDK initWithParameter:@"20387|1105|673842&gfqkhIOS_IOS_0001" complete:^(NSError * error1) {
  44. //检查是否有漏单
  45. //[XenonSDK.sharedSDK checkOrderStatus];
  46. //登录
  47. if (error1 == nil) {
  48. [XenonSDK.sharedSDK hAutoWithComplete:^(id user, NSError *error) {
  49. NSLog(@"user==%@",user);
  50. NSLog(@"自动登录error==%@",error);
  51. }];
  52. }else{
  53. NSLog(@"SDK初始化失败,error1==%@",error1);
  54. }
  55. }];
  56. //1.设置window的rootViewController.
  57. // if (self.window == nil) {
  58. // UIWindow *keyWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  59. // [keyWindow makeKeyAndVisible];
  60. // self.window = keyWindow;
  61. // self.window.rootViewController = [self rootViewController];
  62. // }
  63. //2. 穿山甲广告 SDK init
  64. [XenonSDK.sharedSDK CSJAdSDKinit];
  65. //3. 穿山甲开屏广告测试
  66. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  67. // [XenonSDK.sharedSDK openBUDSplashAd:@"splash001" callback:^(BOOL ready) {
  68. //
  69. // if (ready) {
  70. // NSLog(@"[穿山甲广告]result:开屏广告加载成功!");
  71. // }else{
  72. // NSLog(@"[穿山甲广告]result:开屏广告加载失败!");
  73. // }
  74. // }];
  75. // });
  76. //4. 优量汇广告 SDK init
  77. // [XenonSDK.sharedSDK YLHAdSDKinit];
  78. //开屏广告测试
  79. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  80. // [XenonSDK.sharedSDK openYLHSplashAd:@"YLH_splash001" supportZoomoutView:NO callback:^(BOOL ready) {
  81. // if (ready) {
  82. // NSLog(@"[优量汇广告]result:开屏广告加载成功!");
  83. // }else{
  84. // NSLog(@"[优量汇广告]result:开屏广告加载失败!");
  85. // }
  86. // }];
  87. // });
  88. //5. TopOn广告 SDK init
  89. // [XenonSDK.sharedSDK TopOnAdSDKinit];
  90. //TopOn开屏广告测试
  91. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  92. // [XenonSDK.sharedSDK openTOPONSplashAd:@"TopOnsplash001" callback:^(BOOL ready) {
  93. // if (ready) {
  94. // NSLog(@"[TopOn广告]result:开屏广告加载成功!");
  95. // }else{
  96. // NSLog(@"[TopOn广告]result:开屏广告加载失败!");
  97. // }
  98. // }];
  99. // });
  100. return YES;
  101. }
  102. #pragma mark - Test
  103. //- (UIViewController *)rootViewController {
  104. // //主页面
  105. // KWBUDAdmobFullScreenCusEventVC *mainViewController = [[KWBUDAdmobFullScreenCusEventVC alloc] init]; //Main VC
  106. // UINavigationController *navigationVC = [[UINavigationController alloc] initWithRootViewController:mainViewController];
  107. // return navigationVC;
  108. //}
  109. - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(nonnull NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
  110. //facebook SDK
  111. [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url options:options];
  112. return YES;
  113. }
  114. #pragma mark - ===========applicationWillResignActive================
  115. - (void)applicationWillResignActive:(UIApplication *)application {
  116. // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
  117. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
  118. }
  119. - (void)applicationDidEnterBackground:(UIApplication *)application {
  120. // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
  121. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  122. }
  123. - (void)applicationWillEnterForeground:(UIApplication *)application {
  124. // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
  125. }
  126. - (void)applicationDidBecomeActive:(UIApplication *)application {
  127. // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
  128. }
  129. - (void)applicationWillTerminate:(UIApplication *)application {
  130. // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  131. }
  132. //设置成横屏.
  133. //- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
  134. // if (window.rootViewController.presentedViewController.parentViewController != nil) {
  135. // return UIInterfaceOrientationMaskAll;
  136. // }
  137. // return UIInterfaceOrientationMaskLandscape;
  138. //}
  139. @end