diff --git a/HD wallpaper.xcodeproj/project.pbxproj b/HD wallpaper.xcodeproj/project.pbxproj index 9e31bbf..726db13 100644 --- a/HD wallpaper.xcodeproj/project.pbxproj +++ b/HD wallpaper.xcodeproj/project.pbxproj @@ -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)"; diff --git a/HD wallpaper.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate b/HD wallpaper.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate index ceaa401..8bea061 100644 Binary files a/HD wallpaper.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate and b/HD wallpaper.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/HD wallpaper/AppDelegate.m b/HD wallpaper/AppDelegate.m index a63bab2..fc993ea 100644 --- a/HD wallpaper/AppDelegate.m +++ b/HD wallpaper/AppDelegate.m @@ -7,18 +7,56 @@ #import "WPForMyViewController.h" #import "WallPapaerADManager.h" -@interface AppDelegate () +#import +#import +@interface AppDelegate () +@property (nonatomic,strong) NSTimer *attTimer; @end @implementation AppDelegate + +//检查idfa的att弹框 + - (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];