Apple 2024 will review the App's privacy manifests in the spring, and any apps that don't submit a privacy list may be called back. For now, the privacy list is broken down by component, to facilitate the maintenance of component privacy, cocoapods-privacy is developed for management. Click to view details on Apple
As name as,cocoapods-privacy is a plugin for privacy manifests, and focus on cocoapods!
$ gem install cocoapods-privacy
First of all, you must set a json config to cocoapods-privacy, this is a defalut config.json
$ pod privacy config https://raw.githubusercontent.com/ymoyao/cocoapods-privacy/main/resources/config.json
There has 3 keys in defalut config, defalut rule is :To exclude retrieval a component that git source contains certain ‘github.com’ keywords
"source.white.list": [],
"source.black.list": ["github.com"],
"api.template.url": "https://raw.githubusercontent.com/ymoyao/cocoapods-privacy/main/resources/NSPrivacyAccessedAPITypes.plist"
- source.white.list : a white list of source, it effective in command 'pod privacy install' or 'pod install --privacy', will search white list for NSPrivacyAccessedAPITypes.
- when the whitelist is an empty array, it means all components are whitelist(default config).
- when the whitelist is not empty, it means only the components in the whitelist array are retrieved.
- source.black.list : a black list of source, defalut is ‘github.com’, based on the whitelist, the components need to be excluded。 it effective in command 'pod privacy install' or 'pod install --privacy'.
- api.template.url : its required, a template for search NSPrivacyAccessedAPITypes, you can use the provided by default。
If your needs are not met, you can custom! For example, there has some components,and it‘s your local config
"source.white.list": ["https://github.com/ReactiveCocoa/ReactiveObjC.git","git.yourserver.com","git.otherserver.com"],
"source.black.list": ["github.com","https://github.com/AFNetworking/AFNetworking.git"],
"api.template.url": "https://raw.githubusercontent.com/ymoyao/cocoapods-privacy/main/resources/NSPrivacyAccessedAPITypes.plist"
https://github.com/AFNetworking/AFNetworking.git ❌ (it's in 'github.com' black list)
https://github.com/ReactiveCocoa/ReactiveObjC.git ❌ (it's in 'github.com' black list, although also on the white list,but the blacklist priority is high when conflict)
https://git.yourserver.com/xxx/xxxx.git ✅
https://git.yourserver.com/mmm/mmm.git ✅
https://git.otherserver.com/ssss/ssss.git ✅
https://git.yourserver.com/AFNetworking/AFNetworking.git ✅
After custom,you just update config by local like this
$ pod privacy config /yourfilepath/config.json
In a word, if you define both white and black lists ,final search range: white list minus black list, and empty white list means all!
$ pod privacy spec [podspec_file_path]
This command will auto create privacy file, and search the path of podspec' source_files' define relate to NSPrivacyAccessedAPITypes, finaly, write to PrivacyInfo.xcprivacy file. if your component has much subspec, all subspec that define ‘source_files’ will create PrivacyInfo.xcprivacy, and auto modify .podspec link .xcprivacy to 'resource_bundle' key. For example
- origin podspec
Pod::Spec.new do |s|
s.name = 'Demo'
...
s.source_files = 'xxxx'
s.subspec 'idfa' do |sp|
sp.source_files = 'xxxxx'
end
s.subspec 'noidfa' do |sp|
end
end
- podspec after commad 👇👇👇👇👇👇
Pod::Spec.new do |s|
s.name = 'Demo'
...
s.source_files = 'xxxx'
s.resource_bundle = {"Demo.privacy"=>"Pod/Privacy/Demo/PrivacyInfo.xcprivacy"}
s.subspec 'idfa' do |sp|
sp.source_files = 'xxxxx'
sp.resource_bundle = {"Demo.idfa.privacy"=>"Pod/Privacy/Demo.idfa/PrivacyInfo.xcprivacy"}
end
s.subspec 'noidfa' do |sp|
end
end
![截屏2024-02-02 11 23 21](https://private-user-images.githubusercontent.com/13619221/301717210-a6678c8e-c4aa-4f7d-8881-657c6d703657.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM0MDQzODMsIm5iZiI6MTcyMzQwNDA4MywicGF0aCI6Ii8xMzYxOTIyMS8zMDE3MTcyMTAtYTY2NzhjOGUtYzRhYS00ZjdkLTg4ODEtNjU3YzZkNzAzNjU3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODExVDE5MjEyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM5ZjhjMDllMzA4YWZkNWJhMmE4YjEwZjI0MTJhYThiYWM5ZjYzMDdhNDFjNWVlZTQ5YWE3OTkxYmI1YjE1NDUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.o-DDil4_FZLpwSm8PT1FwlZkSUUHElDKjTa8qiitje8)
$ pod install --privacy
or
$ pod privacy install
![截屏2024-02-02 10 59 59](https://private-user-images.githubusercontent.com/13619221/301714239-c6f10e36-0f62-497a-93d4-f8b336dc8df4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM0MDQzODMsIm5iZiI6MTcyMzQwNDA4MywicGF0aCI6Ii8xMzYxOTIyMS8zMDE3MTQyMzktYzZmMTBlMzYtMGY2Mi00OTdhLTkzZDQtZjhiMzM2ZGM4ZGY0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODExVDE5MjEyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQxMDc2OTY1ZjA5MDI1NGM3OGRjNmExMmIzNGU1NTJmYWU5NTRjMDk3ZTBkNWE1NGJlYjIyNGIwMmZiMmFmZDkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.68ilPspomGxvul7XzrMUoH6hJXoMiW60pD07yuAgF7g)
After command, a PrivacyInfo.xcprivacy will create to you project Resources if empty.
Components that meet all of the following items will be processed.
- do not have their own privacy manifest file components
- in white list and not in black list components
- source code components(binary components please deal with command
pod privacy spec
)
The plugin is focus on NSPrivacyAccessedAPITypes and automatically search and create workflow. you should manager NSPrivacyCollectedDataTypes by yourself!
Could you please consider giving our repository a star🌟🌟🌟? It would mean a lot to us and help our project gain more visibility. Thank you!