From a8ed6148d4348e7fee13f28481e3d7b773c1a5ea Mon Sep 17 00:00:00 2001 From: Jason Morcos Date: Sun, 26 Feb 2023 13:22:12 -0800 Subject: [PATCH] Ruggedize app tracking transparency prompting --- MOBAdvertising.podspec | 2 +- _Project/Podfile.lock | 34 ++++++++++----------- _Project/Sources/Info.plist | 2 +- _Project/Sources/MOBAdvertisingBanner.swift | 21 ++++++++++++- 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/MOBAdvertising.podspec b/MOBAdvertising.podspec index 06d2596..2351de7 100755 --- a/MOBAdvertising.podspec +++ b/MOBAdvertising.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'MOBAdvertising' - s.version = '8.0.3' + s.version = '8.0.4' s.summary = 'A wrapper for GogleMobileAds that allows one to present banner ads that show with any application, including a tab bar application' s.homepage = 'https://github.com/Moballo-LLC/MOBAdvertising' s.license = 'MIT' diff --git a/_Project/Podfile.lock b/_Project/Podfile.lock index a88808e..46e4ec4 100644 --- a/_Project/Podfile.lock +++ b/_Project/Podfile.lock @@ -2,50 +2,50 @@ PODS: - Google-Mobile-Ads-SDK (9.14.0): - GoogleAppMeasurement (< 11.0, >= 7.0) - GoogleUserMessagingPlatform (>= 1.1) - - GoogleAppMeasurement (10.3.0): - - GoogleAppMeasurement/AdIdSupport (= 10.3.0) + - GoogleAppMeasurement (10.5.0): + - GoogleAppMeasurement/AdIdSupport (= 10.5.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.8) - GoogleUtilities/MethodSwizzler (~> 7.8) - GoogleUtilities/Network (~> 7.8) - "GoogleUtilities/NSData+zlib (~> 7.8)" - nanopb (< 2.30910.0, >= 2.30908.0) - - GoogleAppMeasurement/AdIdSupport (10.3.0): - - GoogleAppMeasurement/WithoutAdIdSupport (= 10.3.0) + - GoogleAppMeasurement/AdIdSupport (10.5.0): + - GoogleAppMeasurement/WithoutAdIdSupport (= 10.5.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.8) - GoogleUtilities/MethodSwizzler (~> 7.8) - GoogleUtilities/Network (~> 7.8) - "GoogleUtilities/NSData+zlib (~> 7.8)" - nanopb (< 2.30910.0, >= 2.30908.0) - - GoogleAppMeasurement/WithoutAdIdSupport (10.3.0): + - GoogleAppMeasurement/WithoutAdIdSupport (10.5.0): - GoogleUtilities/AppDelegateSwizzler (~> 7.8) - GoogleUtilities/MethodSwizzler (~> 7.8) - GoogleUtilities/Network (~> 7.8) - "GoogleUtilities/NSData+zlib (~> 7.8)" - nanopb (< 2.30910.0, >= 2.30908.0) - GoogleUserMessagingPlatform (2.0.1) - - GoogleUtilities/AppDelegateSwizzler (7.10.0): + - GoogleUtilities/AppDelegateSwizzler (7.11.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - - GoogleUtilities/Environment (7.10.0): + - GoogleUtilities/Environment (7.11.0): - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/Logger (7.10.0): + - GoogleUtilities/Logger (7.11.0): - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (7.10.0): + - GoogleUtilities/MethodSwizzler (7.11.0): - GoogleUtilities/Logger - - GoogleUtilities/Network (7.10.0): + - GoogleUtilities/Network (7.11.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (7.10.0)" - - GoogleUtilities/Reachability (7.10.0): + - "GoogleUtilities/NSData+zlib (7.11.0)" + - GoogleUtilities/Reachability (7.11.0): - GoogleUtilities/Logger - nanopb (2.30909.0): - nanopb/decode (= 2.30909.0) - nanopb/encode (= 2.30909.0) - nanopb/decode (2.30909.0) - nanopb/encode (2.30909.0) - - PromisesObjC (2.1.1) + - PromisesObjC (2.2.0) DEPENDENCIES: - Google-Mobile-Ads-SDK (~> 9.14) @@ -61,12 +61,12 @@ SPEC REPOS: SPEC CHECKSUMS: Google-Mobile-Ads-SDK: 4fe6304b771f8467d29978cb790ec1e56e646946 - GoogleAppMeasurement: c7d6fff39bf2d829587d74088d582e32d75133c3 + GoogleAppMeasurement: 40c70a7d89013f0eca72006c4b9732163ea4cdae GoogleUserMessagingPlatform: 5f8b30daf181805317b6b985bb51c1ff3beca054 - GoogleUtilities: bad72cb363809015b1f7f19beb1f1cd23c589f95 + GoogleUtilities: c2bdc4cf2ce786c4d2e6b3bcfd599a25ca78f06f nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431 - PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb + PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef -PODFILE CHECKSUM: 1566d0d7b9c7780a7edccf68971a17aa067e67a7 +PODFILE CHECKSUM: e424c0338f848e12d1539d8b20c250ffcd23ce3f COCOAPODS: 1.11.3 diff --git a/_Project/Sources/Info.plist b/_Project/Sources/Info.plist index ac35528..f1698a7 100755 --- a/_Project/Sources/Info.plist +++ b/_Project/Sources/Info.plist @@ -9,7 +9,7 @@ CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion - 8.0.3 + 8.0.4 CFBundleName $(PRODUCT_NAME) CFBundlePackageType diff --git a/_Project/Sources/MOBAdvertisingBanner.swift b/_Project/Sources/MOBAdvertisingBanner.swift index 32727b2..a15929c 100755 --- a/_Project/Sources/MOBAdvertisingBanner.swift +++ b/_Project/Sources/MOBAdvertisingBanner.swift @@ -103,7 +103,16 @@ NSLog("adView:ASIdentifierManager Tracking UUID: " + ASIdentifierManager.shared().advertisingIdentifier.uuidString) #if canImport(AppTrackingTransparency) if #available(iOS 14, *) { - if(ATTrackingManager.trackingAuthorizationStatus == .notDetermined || ASIdentifierManager.shared().advertisingIdentifier.uuidString.starts(with: "00000000")) { + //Guard for application not yet being active + if(UIApplication.shared.applicationState != .active) { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: { + self.requestIDFA() + }) + return; + } + + //Request authorization + if(ATTrackingManager.trackingAuthorizationStatus == .notDetermined) { ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in // Tracking authorization completed. Start loading ads here. if status == ATTrackingManager.AuthorizationStatus.authorized { @@ -118,13 +127,23 @@ NSLog("adView:ASIdentifierManager ATTrackingManager=UNKNOWN STATE OCCURED") } + //Check for failed check for tracking advertising + if(status == .notDetermined) { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: { + self.requestIDFA() + }) + return; + } + self.bannerLoad() }) return; } + } #endif NSLog("adView:ASIdentifierManager skipping requesting tracking permission. ASIdentifierManager.isAdvertisingTrackingEnabled=" + (ASIdentifierManager.shared().isAdvertisingTrackingEnabled ? "Yes" : "No")); + self.bannerLoad() }