64 lines
2.0 KiB
Objective-C
64 lines
2.0 KiB
Objective-C
//
|
||
// AppDelegate.m
|
||
// xplan-ios
|
||
//
|
||
// Created by zu on 2021/8/31.
|
||
//
|
||
|
||
#import "AppDelegate.h"
|
||
#import "TabbarViewController.h"
|
||
#import "BaseNavigationController.h"
|
||
#import "FlutterBoost+Xplan.h"
|
||
#import "AppDelegate+ThirdConfig.h"
|
||
#import <AppTrackingTransparency/AppTrackingTransparency.h>
|
||
|
||
@interface AppDelegate ()
|
||
|
||
@end
|
||
|
||
@implementation AppDelegate
|
||
|
||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||
[[FlutterBoost instance] setup:application];
|
||
TabbarViewController *vc = [[TabbarViewController alloc] init];
|
||
BaseNavigationController *bnc = [[BaseNavigationController alloc] initWithRootViewController:vc];
|
||
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||
self.window.rootViewController = bnc;
|
||
[self.window makeKeyAndVisible];
|
||
///初始化一些 sdk配置
|
||
[self initThirdConfig];
|
||
return YES;
|
||
}
|
||
|
||
- (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;
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
@end
|