AppDelegate.m 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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 * error) {
  44. //检查是否有漏单
  45. //[XenonSDK.sharedSDK checkOrderStatus];
  46. //登录
  47. [XenonSDK.sharedSDK hAutoWithComplete:^(id user, NSError *error) {
  48. if(error == nil){
  49. NSLog(@"登录成功,user==%@",user);
  50. }else{
  51. NSLog(@"自动登录:error=%@",error);
  52. }
  53. }];
  54. }];
  55. //1.设置window的rootViewController.
  56. // if (self.window == nil) {
  57. // UIWindow *keyWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  58. // [keyWindow makeKeyAndVisible];
  59. // self.window = keyWindow;
  60. // self.window.rootViewController = [self rootViewController];
  61. // }
  62. //2. 穿山甲广告 SDK init
  63. [XenonSDK.sharedSDK CSJAdSDKinit];
  64. //3. 穿山甲开屏广告测试
  65. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  66. // [XenonSDK.sharedSDK openBUDSplashAd:@"splash001" callback:^(BOOL ready) {
  67. //
  68. // if (ready) {
  69. // NSLog(@"[穿山甲广告]result:开屏广告加载成功!");
  70. // }else{
  71. // NSLog(@"[穿山甲广告]result:开屏广告加载失败!");
  72. // }
  73. // }];
  74. // });
  75. //4. 优量汇广告 SDK init
  76. // [XenonSDK.sharedSDK YLHAdSDKinit];
  77. //开屏广告测试
  78. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  79. // [XenonSDK.sharedSDK openYLHSplashAd:@"YLH_splash001" supportZoomoutView:NO callback:^(BOOL ready) {
  80. // if (ready) {
  81. // NSLog(@"[优量汇广告]result:开屏广告加载成功!");
  82. // }else{
  83. // NSLog(@"[优量汇广告]result:开屏广告加载失败!");
  84. // }
  85. // }];
  86. // });
  87. //5. TopOn广告 SDK init
  88. // [XenonSDK.sharedSDK TopOnAdSDKinit];
  89. //TopOn开屏广告测试
  90. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  91. // [XenonSDK.sharedSDK openTOPONSplashAd:@"TopOnsplash001" callback:^(BOOL ready) {
  92. // if (ready) {
  93. // NSLog(@"[TopOn广告]result:开屏广告加载成功!");
  94. // }else{
  95. // NSLog(@"[TopOn广告]result:开屏广告加载失败!");
  96. // }
  97. // }];
  98. // });
  99. return YES;
  100. }
  101. #pragma mark - Test
  102. //- (UIViewController *)rootViewController {
  103. // //主页面
  104. // KWBUDAdmobFullScreenCusEventVC *mainViewController = [[KWBUDAdmobFullScreenCusEventVC alloc] init]; //Main VC
  105. // UINavigationController *navigationVC = [[UINavigationController alloc] initWithRootViewController:mainViewController];
  106. // return navigationVC;
  107. //}
  108. - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(nonnull NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
  109. //facebook SDK
  110. [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url options:options];
  111. return YES;
  112. }
  113. #pragma mark - ===========applicationWillResignActive================
  114. - (void)applicationWillResignActive:(UIApplication *)application {
  115. // 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.
  116. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
  117. }
  118. - (void)applicationDidEnterBackground:(UIApplication *)application {
  119. // 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.
  120. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  121. }
  122. - (void)applicationWillEnterForeground:(UIApplication *)application {
  123. // 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.
  124. }
  125. - (void)applicationDidBecomeActive:(UIApplication *)application {
  126. // 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.
  127. }
  128. - (void)applicationWillTerminate:(UIApplication *)application {
  129. // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  130. }
  131. //设置成横屏.
  132. //- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
  133. // if (window.rootViewController.presentedViewController.parentViewController != nil) {
  134. // return UIInterfaceOrientationMaskAll;
  135. // }
  136. // return UIInterfaceOrientationMaskLandscape;
  137. //}
  138. @end