AppDelegate.m 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. @interface AppDelegate ()
  10. @end
  11. @implementation AppDelegate
  12. //#define T_FOREACH_ARGC_(_0,_1,_2,_3,_4,_5,_6,_7,N,...) N
  13. //#define T_FOREACH_ARGC(...) T_FOREACH_ARGC_(0, ##__VA_ARGS__, 7,6,5,4,3,2,1,0)
  14. //
  15. //#define T_FOREACH_1(F,N,_1) F(_1)
  16. //#define T_FOREACH_2(F,N,_1,_2) T_FOREACH_1(F,N,_1) N F(_2)
  17. //#define T_FOREACH_3(F,N,_1,_2,_3) T_FOREACH_2(F,N,_1,_2) N F(_3)
  18. //#define T_FOREACH_4(F,N,_1,_2,_3,_4) T_FOREACH_3(F,N,_1,_2,_3) N F(_4)
  19. //#define T_FOREACH_5(F,N,_1,_2,_3,_4,_5) T_FOREACH_4(F,N,_1,_2,_3,_4) N F(_5)
  20. //#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)
  21. //#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)
  22. //
  23. //#define T_FOREACH_CONCAT_(A, B) A ## B
  24. //#define T_FOREACH_CONCAT(A, B) T_FOREACH_CONCAT_(A, B)
  25. //
  26. //#define T_FOREACH(F, N, ...) T_FOREACH_CONCAT(T_FOREACH_, T_FOREACH_ARGC(__VA_ARGS__))(F, N, __VA_ARGS__)
  27. //
  28. //#define T_FORMATS_U(P) @#P"=%@"
  29. //#define T_FORMATS(...) T_FOREACH(T_FORMATS_U, ", ", ##__VA_ARGS__)
  30. //
  31. //#define T(...) NSLog(@"%s " T_FORMATS(__VA_ARGS__), __func__, __VA_ARGS__)
  32. #pragma mark - ==========AdjustDelegate==========
  33. - (void)adjustAttributionChanged:(nullable ADJAttribution *)attribution {
  34. //...
  35. }
  36. ///事件跟踪成功
  37. - (void)adjustEventTrackingSucceeded:(nullable ADJEventSuccess *)eventSuccessResponseData {
  38. //...
  39. }
  40. ///事件跟踪失败
  41. - (void)adjustEventTrackingFailed:(ADJEventFailure *)eventFailureResponseData {
  42. //...
  43. }
  44. ///会话跟踪成功
  45. - (void)adjustSessionTrackingSucceeded:(ADJSessionSuccess *)sessionSuccessResponseData {
  46. //...
  47. }
  48. ///会话跟踪失败
  49. - (void)adjustSessionTrackingFailed:(ADJSessionFailure *)sessionFailureResponseData {
  50. //...
  51. }
  52. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  53. //1. Adjust SDK init.
  54. NSString *appToken = [NSBundle mainBundle].infoDictionary[@"kAppToken"];
  55. NSString *environment = ADJEnvironmentSandbox;
  56. //开发:ADJEnvironmentSandbox, 线上:ADJEnvironmentProduction
  57. ADJConfig *adjustConfig = [ADJConfig configWithAppToken:appToken environment:environment];
  58. [adjustConfig setLogLevel:ADJLogLevelVerbose];
  59. [adjustConfig setSendInBackground:YES];
  60. [adjustConfig setDelegate:self];
  61. [Adjust appDidLaunch:adjustConfig];
  62. //2. firebase SDK init
  63. [FIRApp configure];
  64. //自定义事件.
  65. //[FIRAnalytics logEventWithName:@"share_image" parameters:@{@"id": @"image123"}];
  66. //3.Facebook SDK init
  67. [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
  68. return YES;
  69. }
  70. - (void)applicationWillResignActive:(UIApplication *)application {
  71. // 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.
  72. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
  73. }
  74. - (void)applicationDidEnterBackground:(UIApplication *)application {
  75. // 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.
  76. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  77. }
  78. - (void)applicationWillEnterForeground:(UIApplication *)application {
  79. // 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.
  80. }
  81. - (void)applicationDidBecomeActive:(UIApplication *)application {
  82. // 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.
  83. }
  84. - (void)applicationWillTerminate:(UIApplication *)application {
  85. // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  86. }
  87. //
  88. //- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
  89. // if (window.rootViewController.presentedViewController.parentViewController != nil) {
  90. // return UIInterfaceOrientationMaskAll;
  91. // }
  92. // return UIInterfaceOrientationMaskLandscape;
  93. //}
  94. @end