添加完毕att

This commit is contained in:
bluesea 2024-07-03 19:56:37 +08:00
parent e8b2529f59
commit 7e07fe25a0
3 changed files with 46 additions and 6 deletions

View File

@ -486,12 +486,13 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 0;
DEVELOPMENT_TEAM = U3NR9V77CM;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "HD wallpaper/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "Trend Wallpaper";
INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "Save Image To Photo Library";
INFOPLIST_KEY_NSUserTrackingUsageDescription = "我们想使用您的设备的广告追踪权限来为您推荐个性化的广告";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard;
INFOPLIST_KEY_UIMainStoryboardFile = "";
@ -502,7 +503,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.1;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.trendwallpaper.app;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -520,12 +521,13 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 0;
DEVELOPMENT_TEAM = U3NR9V77CM;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "HD wallpaper/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "Trend Wallpaper";
INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "Save Image To Photo Library";
INFOPLIST_KEY_NSUserTrackingUsageDescription = "我们想使用您的设备的广告追踪权限来为您推荐个性化的广告";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard;
INFOPLIST_KEY_UIMainStoryboardFile = "";
@ -536,7 +538,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.1;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.trendwallpaper.app;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@ -7,18 +7,56 @@
#import "WPForMyViewController.h"
#import "WallPapaerADManager.h"
@interface AppDelegate ()
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/ASIdentifierManager.h>
@interface AppDelegate ()
@property (nonatomic,strong) NSTimer *attTimer;
@end
@implementation AppDelegate
//idfaatt
- (void)checkATT{
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
// 使idfa
if(status == ATTrackingManagerAuthorizationStatusNotDetermined) {
if(self.attTimer == nil) {
self.attTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(checkATT) userInfo:nil repeats:YES];
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
if (status != ATTrackingManagerAuthorizationStatusNotDetermined) {
NSLog(@"用户已做出选择");
[self invalidATTTimer];
}
else {
NSLog(@"用户未做出选择,可能是弹框未弹出...");
}
}];
}
}
else{
[self invalidATTTimer];
}
}];
}
-(void)invalidATTTimer{
if( _attTimer ){
[_attTimer invalidate];
}
_attTimer = nil;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[WallPapaerADManager shareInstance] configureAD];
[self checkATT];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];