Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: release 3.7.0 #273

Merged
merged 21 commits into from
Sep 18, 2023
Merged

feat: release 3.7.0 #273

merged 21 commits into from
Sep 18, 2023

Conversation

YoloMao
Copy link
Collaborator

@YoloMao YoloMao commented Sep 15, 2023

pick 了 #268 中部分 commit 到 3.x 版本上

  • revert: UISwitch 改回 VIEW_CLICK 事件
  • fix: UIAlertController/UISegment swizzle 延迟到初始化时
  • fix: mobile debugger bug
  • fix: hybrid 移除无效 log message
  • build: 更新 generate_xcframework.sh 以适配 macOS (仅生成 GrowingTracker 时)
  • docs: update Readme, use .spi.yml
  • feat: add privacy manifest support,见:refactor: refactoring autotrack core in sdk 4.x #268 (comment)
  • chore: update minimum deployment target to iOS 10.0

以及一些 CI 和代码格式的调整

@codecov
Copy link

codecov bot commented Sep 15, 2023

Codecov Report

Merging #273 (088759c) into master (8dcd2bf) will decrease coverage by 4.96%.
The diff coverage is 63.63%.

@@            Coverage Diff             @@
##           master     #273      +/-   ##
==========================================
- Coverage   79.40%   74.44%   -4.96%     
==========================================
  Files         127      137      +10     
  Lines        6739    10291    +3552     
==========================================
+ Hits         5351     7661    +2310     
- Misses       1388     2630    +1242     
Files Changed Coverage Δ
...utotrack/NSNotificationCenter+GrowingAutotracker.m 100.00% <ø> (ø)
.../Autotrack/UISegmentedControl+GrowingAutotracker.m 98.41% <ø> (+11.62%) ⬆️
...rowingNode/Category/UICollectionView+GrowingNode.m 67.92% <ø> (-4.81%) ⬇️
...rCore/GrowingNode/Category/UIControl+GrowingNode.m 69.69% <ø> (-4.22%) ⬇️
...kerCore/GrowingNode/Category/UILabel+GrowingNode.m 71.42% <ø> (-8.58%) ⬇️
...Node/Category/UINavigationController+GrowingNode.m 0.00% <ø> (ø)
...wingNode/Category/UITabBarController+GrowingNode.m 0.00% <ø> (ø)
...ore/GrowingNode/Category/UITableView+GrowingNode.m 54.09% <ø> (-2.43%) ⬇️
...ckerCore/GrowingNode/Category/UIView+GrowingNode.m 77.39% <ø> (-3.76%) ⬇️
...ackerCore/DeepLink/GrowingAppDelegateAutotracker.m 34.58% <ø> (-1.01%) ⬇️
... and 12 more

... and 118 files with indirect coverage changes

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

85.7% 85.7% Coverage
5.0% 5.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@YoloMao
Copy link
Collaborator Author

YoloMao commented Sep 18, 2023

对于 privacy manifest 支持,目前 SDK 支持如下集成方式:

集成方式 framework 类型 privacy manifest 所在位置
Cocoapods dynamic iOS: Frameworks/GrowingAnalytics.framework/GrowingAnalytics.bundle/PrivacyInfo.xcprivacy
macOS: Contents/Frameworks/GrowingAnalytics.framework/Versions/A/Resources/ GrowingAnalytics.bundle/Contents/Resources/PrivacyInfo.xcprivacy
Cocoapods static iOS: GrowingAnalytics.bundle/PrivacyInfo.xcprivacy
macOS: Contents/Resources/GrowingAnalytics.bundle/Contents/Resources/PrivacyInfo.xcprivacy
SwiftPM static iOS: GrowingAnalytics_GrowingResources.bundle/PrivacyInfo.xcprivacy
macOS: Contents/Resources/GrowingAnalytics_GrowingResources_macOS.bundle/Contents/ Resources/PrivacyInfo.xcprivacy
Manual static 需要用户按照下方的【手动集成说明】步骤将内容填写到 App 的 PrivacyInfo.xcprivacy

出于性能考虑,当前不提供 SwiftPM + dynamic,Manual + dynamic 的集成方式

Cocoapods 可以通过 Multi-platform support 来区分 iOS/macOS 上所需提供的不同的 PrivacyInfo.xcprivacy,而 swiftPM 官方貌似并没有提供比较方便的配置,见:https://forums.swift.org/t/platform-specific-resources/43612/9 目前通过 target wrapper 解决

手动集成说明

  1. build: github action for auto-release #259 (comment)
  2. 手动添加以下内容到您的 App 的 PrivacyInfo.xcprivacy 中:
<key>NSPrivacyAccessedAPITypes</key>
<array>
  <dict>
    <key>NSPrivacyAccessedAPIType</key>
    <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
    <key>NSPrivacyAccessedAPITypeReasons</key>
    <array>
      <string>CA92.1</string>
    </array>
  </dict>
  <dict>
    <key>NSPrivacyAccessedAPIType</key>
    <string>NSPrivacyAccessedAPICategorySystemBootTime</string>
    <key>NSPrivacyAccessedAPITypeReasons</key>
    <array>
      <string>35F9.1</string>
    </array>
  </dict>
</array>
  1. 如您所发布的是 macOS 应用,则还需要添加以下内容到您的 App 的 PrivacyInfo.xcprivacy 中:
<key>NSPrivacyCollectedDataTypes</key>
<array>
  <dict>
    <key>NSPrivacyCollectedDataType</key>
    <string>NSPrivacyCollectedDataTypeUserID</string>
    <key>NSPrivacyCollectedDataTypeLinked</key>
    <true/>
    <key>NSPrivacyCollectedDataTypeTracking</key>
    <true/>
    <key>NSPrivacyCollectedDataTypePurposes</key>
    <array>
      <string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
    </array>
  </dict>
  <dict>
    <key>NSPrivacyCollectedDataType</key>
    <string>NSPrivacyCollectedDataTypeDeviceID</string>
    <key>NSPrivacyCollectedDataTypeLinked</key>
    <true/>
    <key>NSPrivacyCollectedDataTypeTracking</key>
    <true/>
    <key>NSPrivacyCollectedDataTypePurposes</key>
    <array>
      <string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
    </array>
  </dict>
  <dict>
    <key>NSPrivacyCollectedDataType</key>
    <string>NSPrivacyCollectedDataTypeProductInteraction</string>
    <key>NSPrivacyCollectedDataTypeLinked</key>
    <true/>
    <key>NSPrivacyCollectedDataTypeTracking</key>
    <true/>
    <key>NSPrivacyCollectedDataTypePurposes</key>
    <array>
      <string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
    </array>
  </dict>
</array>

YoloMao and others added 3 commits September 18, 2023 17:08
原因: 虽然 MobileDebugger 仅在 iOS 下集成,但 swiftPM 还是会先编译 MD 的依赖再进行平台判断,也就是 screenshot,导致找不到 UIKit 报错
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

86.4% 86.4% Coverage
0.0% 0.0% Duplication

@YoloMao YoloMao merged commit 868523d into master Sep 18, 2023
4 of 6 checks passed
@YoloMao YoloMao deleted the feat/3.6.1 branch September 18, 2023 10:53
@dreampiggy
Copy link

dreampiggy commented Dec 8, 2023

对于 privacy manifest 支持,目前 SDK 支持如下集成方式:

集成方式 framework 类型 privacy manifest 所在位置
Cocoapods dynamic iOS: Frameworks/GrowingAnalytics.framework/GrowingAnalytics.bundle/PrivacyInfo.xcprivacy
macOS: Contents/Frameworks/GrowingAnalytics.framework/Versions/A/Resources/ GrowingAnalytics.bundle/Contents/Resources/PrivacyInfo.xcprivacy
Cocoapods static iOS: GrowingAnalytics.bundle/PrivacyInfo.xcprivacy
macOS: Contents/Resources/GrowingAnalytics.bundle/Contents/Resources/PrivacyInfo.xcprivacy
SwiftPM static iOS: GrowingAnalytics_GrowingResources.bundle/PrivacyInfo.xcprivacy
macOS: Contents/Resources/GrowingAnalytics_GrowingResources_macOS.bundle/Contents/ Resources/PrivacyInfo.xcprivacy
Manual static 需要用户按照下方的【手动集成说明】步骤将内容填写到 App 的 PrivacyInfo.xcprivacy

出于性能考虑,当前不提供 SwiftPM + dynamic,Manual + dynamic 的集成方式
Cocoapods 可以通过 Multi-platform support 来区分 iOS/macOS 上所需提供的不同的 PrivacyInfo.xcprivacy,而 swiftPM 官方貌似并没有提供比较方便的配置,见:https://forums.swift.org/t/platform-specific-resources/43612/9 目前通过 target wrapper 解决

手动集成说明

  1. build: github action for auto-release #259 (comment)
  2. 手动添加以下内容到您的 App 的 PrivacyInfo.xcprivacy 中:
<key>NSPrivacyAccessedAPITypes</key>
<array>
  <dict>
    <key>NSPrivacyAccessedAPIType</key>
    <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
    <key>NSPrivacyAccessedAPITypeReasons</key>
    <array>
      <string>CA92.1</string>
    </array>
  </dict>
  <dict>
    <key>NSPrivacyAccessedAPIType</key>
    <string>NSPrivacyAccessedAPICategorySystemBootTime</string>
    <key>NSPrivacyAccessedAPITypeReasons</key>
    <array>
      <string>35F9.1</string>
    </array>
  </dict>
</array>
  1. 如您所发布的是 macOS 应用,则还需要添加以下内容到您的 App 的 PrivacyInfo.xcprivacy 中:
<key>NSPrivacyCollectedDataTypes</key>
<array>
  <dict>
    <key>NSPrivacyCollectedDataType</key>
    <string>NSPrivacyCollectedDataTypeUserID</string>
    <key>NSPrivacyCollectedDataTypeLinked</key>
    <true/>
    <key>NSPrivacyCollectedDataTypeTracking</key>
    <true/>
    <key>NSPrivacyCollectedDataTypePurposes</key>
    <array>
      <string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
    </array>
  </dict>
  <dict>
    <key>NSPrivacyCollectedDataType</key>
    <string>NSPrivacyCollectedDataTypeDeviceID</string>
    <key>NSPrivacyCollectedDataTypeLinked</key>
    <true/>
    <key>NSPrivacyCollectedDataTypeTracking</key>
    <true/>
    <key>NSPrivacyCollectedDataTypePurposes</key>
    <array>
      <string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
    </array>
  </dict>
  <dict>
    <key>NSPrivacyCollectedDataType</key>
    <string>NSPrivacyCollectedDataTypeProductInteraction</string>
    <key>NSPrivacyCollectedDataTypeLinked</key>
    <true/>
    <key>NSPrivacyCollectedDataTypeTracking</key>
    <true/>
    <key>NSPrivacyCollectedDataTypePurposes</key>
    <array>
      <string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
    </array>
  </dict>
</array>

Apple的Xcode工具有一个功能,能够从一个.app(.ipa)提取并生成一个PDF预览的Privacy Detail Pages
其实现看起来并不能100%兼容上述所有的写法,即它应该假定xcprivacy存在于某个指定目录名的.bundle中(我只尝试过SPM那种.bundle名是可以被扫描到的,还有就是用raw xcodeproj自动创建的放在.framework/根路径下的,不是.bundle)

image

我担心CocoaPods直接利用spec.resource_bundle会存在识别问题,这个会影响后续2024年的新规范的实施吗?
Apple提到是强制规范,意味着ITC的Server,会有工具做二进制的扫描。和那个扫描兼容吗?

@dreampiggy
Copy link

以及,spec.resource_bundle创建的.bundle名该如何选择?

@YoloMao
Copy link
Collaborator Author

YoloMao commented Dec 8, 2023

@dreampiggy 我是直接用我们的 framework name (GrowingAnalytics) 作为 bundle name,在编写这些 commit 时,使用 Xcode 15 beta 测试放在 .bundle 的 privacy 可以正常识别并导出

@YoloMao
Copy link
Collaborator Author

YoloMao commented Dec 8, 2023

@YoloMao
Copy link
Collaborator Author

YoloMao commented Dec 8, 2023

@dreampiggy 下列内容希望对你有帮助

使用 Xcode 15.0 (15A240d) 再次验证,只有 data collects 类型会出现在最后的 privacy report pdf 中,具体格式为:

  • bundle name
    • privacy path
      • data collects decription

用的是 GrowingAnalytics 4.0.0-beta.1 的代码,并添加了一个 data collects 描述以便查看最终的 privacy report pdf 导出形式

Cocoapods + use_frameworks!:
image
Cocoapods + use_frameworks! + :linkage => :static:
image
SPM:
image

use of required reason API 类型则不会

Apple 在文档里有提到:

From Fall 2023 you’ll receive an email from Apple if you upload an app to App Store Connect that uses required reason API without describing the reason in its privacy manifest file. From Spring 2024, apps that don’t describe their use of required reason API in their privacy manifest file won’t be accepted by App Store Connect.

https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api

use of required reason API 类型他们在 ITC Server 应该也会检测


GrowingAnalytics SDK 目前的 privacy 配置中:

  • 对于 iOS 平台没有 data collects 相关的隐私使用描述

You only need to supply NSPrivacyAccessedAPITypes for apps and third-party SDKs on iOS, iPadOS, tvOS, visionOS, and watchOS.
https://developer.apple.com/documentation/bundleresources/privacy_manifest_files#4284009

  • 对于 Mac 平台则有 data collects,最终会按照上述格式显示在通过 Xcode 导出的 privacy report 里

@dreampiggy
Copy link

dreampiggy commented Dec 8, 2023

对于CocoaPods的subspecs,我需要对每个subspecs声明resource_bundles吗?会产生重复的.bundle吗?
还是只要root spec声明即可?

s.subspec 'A' do |A|
  A.resource_bundles = {'SDWebImage' => ['Resources/PrivacyInfo.xcprivacy']}
end
s.subspec 'B' do |B|
  B.resource_bundles = {'SDWebImage' => ['Resources/PrivacyInfo.xcprivacy']}
end
s.resource_bundles = {'SDWebImage' => ['Resources/PrivacyInfo.xcprivacy']}

@YoloMao
Copy link
Collaborator Author

YoloMao commented Dec 8, 2023

对于CocoaPods的subspecs,我需要对每个subspecs声明resource_bundles吗?会产生重复的.bundle吗? 还是只要root spec声明即可?

s.subspec 'A' do |A|
  A.resource_bundles = {'SDWebImage' => ['Resources/PrivacyInfo.xcprivacy']}
end
s.subspec 'B' do |B|
  B.resource_bundles = {'SDWebImage' => ['Resources/PrivacyInfo.xcprivacy']}
end
s.resource_bundles = {'SDWebImage' => ['Resources/PrivacyInfo.xcprivacy']}

只要 root spec, GrowingAnalytics 是因为所有的 spec 都基于 trackerCore,因此放在 trackerCore spec 中

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants