2021-09-06 18:47:38 +08:00
|
|
|
|
//
|
|
|
|
|
// AppDelegate.m
|
|
|
|
|
// xplan-ios
|
|
|
|
|
//
|
|
|
|
|
// Created by zu on 2021/8/31.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#import "AppDelegate.h"
|
|
|
|
|
#import "TabbarViewController.h"
|
2021-09-07 23:05:43 +08:00
|
|
|
|
#import "BaseNavigationController.h"
|
2021-09-09 17:50:03 +08:00
|
|
|
|
#import "FlutterBoost+Xplan.h"
|
2021-09-13 18:56:16 +08:00
|
|
|
|
#import "AppDelegate+ThirdConfig.h"
|
2021-11-21 23:25:19 +08:00
|
|
|
|
#import <AppTrackingTransparency/AppTrackingTransparency.h>
|
2021-09-06 18:47:38 +08:00
|
|
|
|
|
|
|
|
|
@interface AppDelegate ()
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation AppDelegate
|
|
|
|
|
|
|
|
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
2021-09-09 17:50:03 +08:00
|
|
|
|
[[FlutterBoost instance] setup:application];
|
2021-09-06 18:47:38 +08:00
|
|
|
|
TabbarViewController *vc = [[TabbarViewController alloc] init];
|
2021-09-07 23:05:43 +08:00
|
|
|
|
BaseNavigationController *bnc = [[BaseNavigationController alloc] initWithRootViewController:vc];
|
2021-09-06 18:47:38 +08:00
|
|
|
|
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
2021-09-07 23:05:43 +08:00
|
|
|
|
self.window.rootViewController = bnc;
|
2021-09-06 18:47:38 +08:00
|
|
|
|
[self.window makeKeyAndVisible];
|
2021-09-13 18:56:16 +08:00
|
|
|
|
///初始化一些 sdk配置
|
|
|
|
|
[self initThirdConfig];
|
2021-09-06 18:47:38 +08:00
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-21 23:25:19 +08:00
|
|
|
|
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
|
|
|
|
[self getAdvertisingTrackingAuthority];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)getAdvertisingTrackingAuthority {
|
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
|
if (@available(iOS 14, *)) {
|
|
|
|
|
ATTrackingManagerAuthorizationStatus status = ATTrackingManager.trackingAuthorizationStatus;
|
|
|
|
|
switch (status) {
|
|
|
|
|
case ATTrackingManagerAuthorizationStatusDenied:
|
|
|
|
|
NSLog(@"用户拒绝IDFA");
|
|
|
|
|
break;
|
|
|
|
|
case ATTrackingManagerAuthorizationStatusAuthorized:
|
|
|
|
|
NSLog(@"用户允许IDFA");
|
|
|
|
|
break;
|
|
|
|
|
case ATTrackingManagerAuthorizationStatusNotDetermined: {
|
|
|
|
|
NSLog(@"用户未做选择或未弹窗IDFA");
|
|
|
|
|
//请求弹出用户授权框,只会在程序运行是弹框1次,除非卸载app重装,通地图、相机等权限弹框一样
|
|
|
|
|
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
|
|
|
|
|
NSLog(@"app追踪IDFA权限:%lu",(unsigned long)status);
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-06 18:47:38 +08:00
|
|
|
|
@end
|