ソースを参照

add 5.1 idfa 跟踪提示

openlockPPP 1 年間 前
コミット
8ad61adcda

+ 10 - 2
JiaPeiManage.xcodeproj/project.pbxproj

@@ -22,6 +22,8 @@
 		903628D02A41AF3100F0AA6C /* MeTraineeDetails02HeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 903628CF2A41AF3100F0AA6C /* MeTraineeDetails02HeaderView.xib */; };
 		903628D22A41AFA400F0AA6C /* MeTraineeDetails02Cell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 903628D12A41AFA400F0AA6C /* MeTraineeDetails02Cell.swift */; };
 		903628D42A41AFD700F0AA6C /* MeTraineeDetails02Cell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 903628D32A41AFD700F0AA6C /* MeTraineeDetails02Cell.xib */; };
+		903C04AA2A651B1200935764 /* NYIDFA.swift in Sources */ = {isa = PBXBuildFile; fileRef = 903C04A92A651B1200935764 /* NYIDFA.swift */; };
+		903C04AC2A651DBC00935764 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 903C04AB2A651DBC00935764 /* AdSupport.framework */; };
 		9043AD9B2A542267005F6F81 /* StatisticsOfficialPageHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9043AD9A2A542267005F6F81 /* StatisticsOfficialPageHeaderView.swift */; };
 		9043AD9D2A5422BE005F6F81 /* StatisticsOfficialPageHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9043AD9C2A5422BE005F6F81 /* StatisticsOfficialPageHeaderView.xib */; };
 		9043ADA22A554DE9005F6F81 /* CoachQRPageController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9043ADA12A554DE9005F6F81 /* CoachQRPageController.swift */; };
@@ -194,6 +196,8 @@
 		903628CF2A41AF3100F0AA6C /* MeTraineeDetails02HeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MeTraineeDetails02HeaderView.xib; sourceTree = "<group>"; };
 		903628D12A41AFA400F0AA6C /* MeTraineeDetails02Cell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeTraineeDetails02Cell.swift; sourceTree = "<group>"; };
 		903628D32A41AFD700F0AA6C /* MeTraineeDetails02Cell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MeTraineeDetails02Cell.xib; sourceTree = "<group>"; };
+		903C04A92A651B1200935764 /* NYIDFA.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NYIDFA.swift; sourceTree = "<group>"; };
+		903C04AB2A651DBC00935764 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; };
 		9043AD9A2A542267005F6F81 /* StatisticsOfficialPageHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatisticsOfficialPageHeaderView.swift; sourceTree = "<group>"; };
 		9043AD9C2A5422BE005F6F81 /* StatisticsOfficialPageHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = StatisticsOfficialPageHeaderView.xib; sourceTree = "<group>"; };
 		9043ADA12A554DE9005F6F81 /* CoachQRPageController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoachQRPageController.swift; sourceTree = "<group>"; };
@@ -366,6 +370,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				903C04AC2A651DBC00935764 /* AdSupport.framework in Frameworks */,
 				FD091E28E4C2EF8E654AE2C6 /* Pods_JiaPeiManage.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -952,6 +957,7 @@
 				90CE52D42A36E6000033BD06 /* URLNavigationMap.swift */,
 				90CE52D52A36E6000033BD06 /* LocalManager.swift */,
 				909DA5C02A3999B30034501F /* NYTips.swift */,
+				903C04A92A651B1200935764 /* NYIDFA.swift */,
 			);
 			path = Utils;
 			sourceTree = "<group>";
@@ -1026,6 +1032,7 @@
 		A24D99DBE7A92F9485B15E3A /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				903C04AB2A651DBC00935764 /* AdSupport.framework */,
 				90E109CD2A4927A100091BC6 /* libswift_Concurrency.tbd */,
 				1FC2879EF62A9D4DF6777C62 /* Pods_JiaPeiManage.framework */,
 			);
@@ -1250,6 +1257,7 @@
 				90BC4BDE2A3C4691006FD683 /* MeTraineeDetailsPageViewController.swift in Sources */,
 				90A8CD4B2A5F9EE000C02402 /* StatisticsPageViewModel.swift in Sources */,
 				90CE52CB2A36E5EC0033BD06 /* UILabel+Rx.swift in Sources */,
+				903C04AA2A651B1200935764 /* NYIDFA.swift in Sources */,
 				90CE52E12A36E73A0033BD06 /* SplashModel.swift in Sources */,
 				90C9C5592A4C7B45006D3921 /* Notification+NY.swift in Sources */,
 				908FEEAF2A42FA4F00BEB81C /* StuLogFacDataModel.swift in Sources */,
@@ -1467,7 +1475,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1202023071701;
+				CURRENT_PROJECT_VERSION = 1202023071703;
 				DEVELOPMENT_TEAM = K7T6CU5SW5;
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = JiaPeiManage/Info.plist;
@@ -1507,7 +1515,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1202023071701;
+				CURRENT_PROJECT_VERSION = 1202023071703;
 				DEVELOPMENT_TEAM = K7T6CU5SW5;
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = JiaPeiManage/Info.plist;

+ 4 - 0
JiaPeiManage/Sources/Main/App/AppDelegate.swift

@@ -34,6 +34,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
         return true
     }
     
+    func applicationDidBecomeActive(_ application: UIApplication) {
+        let idfa = NYIDFA.getIDFA()
+    }
+    
     func application(
         _ app: UIApplication,
         open url: URL,

+ 1 - 1
JiaPeiManage/Sources/Main/App/CompositionRoot.swift

@@ -100,7 +100,7 @@ final class CompositionRoot {
     }
     
     static func configureUserAgent() {
-        
+
         let webView = WKWebView(frame: .zero)
         webView.evaluateJavaScript("navigator.userAgent") { (oldAgent, error) in
 

+ 11 - 6
JiaPeiManage/Sources/Modulars/Home/Controllers/HomeViewController.swift

@@ -43,6 +43,16 @@ final class HomeViewController: BaseViewController {
         biandView()
     }
     
+    override func viewWillAppear(_ animated: Bool) {
+        super.viewWillAppear(animated)
+        self.codeQr_layout.constant = 0
+        self.codeQrView.isHidden = true
+        if LocalManager.userInfo.userAccount != "350211196508204525" {
+            self.codeQr_layout.constant = 150
+            self.codeQrView.isHidden = false
+        }
+    }
+    
     // MARK: 私有方法
     func setupUI(){
         if isIphoneX {self.nav_top_layout.constant = 24.f}
@@ -51,12 +61,7 @@ final class HomeViewController: BaseViewController {
         self.meStu_button.spacingBetweenImageAndTitle = 5
         self.meMine_button.imagePosition = .right
         self.meMine_button.spacingBetweenImageAndTitle = 5
-        self.codeQr_layout.constant = 0
-        self.codeQrView.isHidden = true
-        if LocalManager.userInfo.userAccount != "350211196508204525" {
-            self.codeQr_layout.constant = 150
-            self.codeQrView.isHidden = false
-        }
+        
     }
     //绑定-rx
     func biandView(){

+ 32 - 0
JiaPeiManage/Sources/Utils/NYIDFA.swift

@@ -0,0 +1,32 @@
+//
+//  NYIDFA.swift
+//  JiaPeiManage
+//
+//  Created by Ning.ge on 2023/7/17.
+//
+
+import AdSupport
+import AppTrackingTransparency
+
+class NYIDFA {
+    
+    static func getIDFA() -> String {
+        var idfa = ""
+        let manager = ASIdentifierManager.shared()
+        if #available(iOS 14, *) {
+            ATTrackingManager.requestTrackingAuthorization { status in
+                if status == .authorized {
+                    idfa = manager.advertisingIdentifier.uuidString
+                }
+            }
+        } else {
+            if manager.isAdvertisingTrackingEnabled {
+                idfa = manager.advertisingIdentifier.uuidString
+            }
+        }
+        return idfa
+    }
+    
+}
+
+