AppDelegate.m 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. @interface AppDelegate ()
  13. @end
  14. @implementation AppDelegate
  15. #pragma mark - ==========AdjustDelegate==========
  16. - (void)adjustAttributionChanged:(nullable ADJAttribution *)attribution {
  17. //...
  18. }
  19. ///事件跟踪成功
  20. - (void)adjustEventTrackingSucceeded:(nullable ADJEventSuccess *)eventSuccessResponseData {
  21. //...
  22. }
  23. ///事件跟踪失败
  24. - (void)adjustEventTrackingFailed:(ADJEventFailure *)eventFailureResponseData {
  25. //...
  26. }
  27. ///会话跟踪成功
  28. - (void)adjustSessionTrackingSucceeded:(ADJSessionSuccess *)sessionSuccessResponseData {
  29. //...
  30. }
  31. ///会话跟踪失败
  32. - (void)adjustSessionTrackingFailed:(ADJSessionFailure *)sessionFailureResponseData {
  33. //...
  34. }
  35. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  36. // Override point for customization after application launch.
  37. //1.facebook SDK init
  38. [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
  39. //2.Adjust SDK init
  40. NSString *appToken = [NSBundle mainBundle].infoDictionary[@"kAppToken"];
  41. NSString *environment = ADJEnvironmentSandbox;
  42. //开发:ADJEnvironmentSandbox, 线上:ADJEnvironmentProduction
  43. ADJConfig *adjustConfig = [ADJConfig configWithAppToken:appToken environment:environment];
  44. [adjustConfig setLogLevel:ADJLogLevelVerbose];
  45. [adjustConfig setSendInBackground:YES];
  46. [adjustConfig setDelegate:self];
  47. //[adjustConfig setDelayStart:5.5];
  48. [Adjust appDidLaunch:adjustConfig];
  49. //3.login&apply SDK init
  50. [XenonSDK.sharedSDK initWithParameter:@"20303|1105|910260&fscsIOS_IOS_0001" complete:^(NSError * error) {
  51. //检查是否有漏单
  52. [XenonSDK.sharedSDK checkOrderStatus];
  53. //登录
  54. [XenonSDK.sharedSDK loginWithComplete:^(id user, NSError * error) {
  55. NSLog(@"SDK初始化成功");
  56. }];
  57. }];
  58. //4. firebase SDK init
  59. [FIRApp configure];
  60. return YES;
  61. }
  62. - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(nonnull NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
  63. [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url options:options];
  64. return YES;
  65. }
  66. - (void)applicationWillResignActive:(UIApplication *)application {
  67. // 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.
  68. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
  69. }
  70. - (void)applicationDidEnterBackground:(UIApplication *)application {
  71. // 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.
  72. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  73. }
  74. - (void)applicationWillEnterForeground:(UIApplication *)application {
  75. // 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.
  76. }
  77. - (void)applicationDidBecomeActive:(UIApplication *)application {
  78. // 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.
  79. }
  80. - (void)applicationWillTerminate:(UIApplication *)application {
  81. // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  82. }
  83. //设置成横屏.
  84. - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
  85. if (window.rootViewController.presentedViewController.parentViewController != nil) {
  86. return UIInterfaceOrientationMaskAll;
  87. }
  88. return UIInterfaceOrientationMaskLandscape;
  89. }
  90. @end