Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add a privacy manifest
Since we don't include the analytics code in builds for the app store, the only
thing we need to declare is that we call fstat() on files in the app container,
which core uses internally to check the size of Realm files. This is assuming
that if the app logs into Atlas that's something that the app itself has to
declare rather than us, as we don't automatically talk to the server on our own
behalf.

The CocoaPods bundling might not actually work. This is the approach that most
of the SDKs on the mandatory privacy manifest list are taking, but since Apple
isn't actually checking the manifests yet no one knows if they'll accept this
fairly weird way of bundling the xcprivacy file. The less weird way breaks
building pods as non-framework static libraries.
  • Loading branch information
tgoyne committed Jan 9, 2024
commit bc54beb294e634f69c4f7a3a44a6f5ad10e342f1
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
x.y.z Release notes (yyyy-MM-dd)
=============================================================
### Enhancements
* None.
* Add a privacy manifest to both frameworks.

### Fixed
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-swift/issues/????), since v?.?.?)
Expand Down
6 changes: 6 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ let package = Package(
"Realm/RLMUser.mm",
"Realm/RLMUserAPIKey.mm"
],
resources: [
.copy("Realm/PrivacyInfo.xcprivacy")
],
publicHeadersPath: "include",
cxxSettings: cxxSettings,
linkerSettings: [
Expand All @@ -268,6 +271,9 @@ let package = Package(
"Nonsync.swift",
"RealmSwift-Info.plist",
"Tests",
],
resources: [
.copy("PrivacyInfo.xcprivacy")
]
),
.target(
Expand Down
1 change: 1 addition & 0 deletions Realm.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ Pod::Spec.new do |s|
'OTHER_LDFLAGS' => '$(REALM_LD_CLASSIC)',
}
s.preserve_paths = %w(include scripts)
s.resource_bundles = {'realm_objc_privacy' => ['Realm/PrivacyInfo.xcprivacy']}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/SDWebImage/SDWebImage/pull/3649/files What I'm seeing in some other SDKs is they use the name of the framework as the key, so shouldn't be
s.resource_bundles = {'Realm' => ['Realm/PrivacyInfo.xcprivacy']}, or maybe it is irrelevant given that we don't know if it is going to even work

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I based this on what Flutter is doing since they appeared to put a bunch of effort into looking into things.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I'm seeing in some other SDKs is they use the name of the framework as the key

FYI, see this comment for the relevant discussion about why we aren't doing that.


s.ios.deployment_target = '11.0'
s.osx.deployment_target = '10.13'
Expand Down
8 changes: 8 additions & 0 deletions Realm.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@
3FD0D7C729675A2E0031C196 /* RLMAsyncTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FD0D7C529675A2E0031C196 /* RLMAsyncTask.h */; settings = {ATTRIBUTES = (Public, ); }; };
3FD0D7C929675A2E0031C196 /* RLMAsyncTask.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FD0D7C629675A2E0031C196 /* RLMAsyncTask.mm */; };
3FD0D7CE2967CA1E0031C196 /* RLMMongoCollection_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = CF76F7D224816AAA00890DD2 /* RLMMongoCollection_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
3FD6D1A92B4C9EFB00A4FEBE /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3FD6D1A82B4C9EFB00A4FEBE /* PrivacyInfo.xcprivacy */; };
3FD6D1AC2B4CA56D00A4FEBE /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3FD6D1AB2B4CA56C00A4FEBE /* PrivacyInfo.xcprivacy */; };
3FDAB841290B4CCB00168F24 /* RLMError.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FDAB83E290B4CCB00168F24 /* RLMError.h */; settings = {ATTRIBUTES = (Public, ); }; };
3FDAB845290B4CCB00168F24 /* RLMError.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FDAB840290B4CCB00168F24 /* RLMError.mm */; };
3FDAB848290B658300168F24 /* file-format-version-21.realm in Resources */ = {isa = PBXBuildFile; fileRef = 3FDAB847290B658300168F24 /* file-format-version-21.realm */; };
Expand Down Expand Up @@ -754,6 +756,8 @@
3FD0D7C529675A2E0031C196 /* RLMAsyncTask.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RLMAsyncTask.h; sourceTree = "<group>"; };
3FD0D7C629675A2E0031C196 /* RLMAsyncTask.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMAsyncTask.mm; sourceTree = "<group>"; };
3FD0D7CB29675AE10031C196 /* RLMAsyncTask_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMAsyncTask_Private.h; sourceTree = "<group>"; };
3FD6D1A82B4C9EFB00A4FEBE /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3FD6D1AB2B4CA56C00A4FEBE /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3FDAB83E290B4CCB00168F24 /* RLMError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMError.h; sourceTree = "<group>"; };
3FDAB83F290B4CCB00168F24 /* RLMError_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMError_Private.hpp; sourceTree = "<group>"; };
3FDAB840290B4CCB00168F24 /* RLMError.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMError.mm; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1351,6 +1355,7 @@
5D660FE71BE98D670021E04F /* ObjectSchema.swift */,
5D660FE81BE98D670021E04F /* Optional.swift */,
3F149CCA2668112A00111D65 /* PersistedProperty.swift */,
3FD6D1AB2B4CA56C00A4FEBE /* PrivacyInfo.xcprivacy */,
0CD1632526D3DD7B0027C49B /* Projection.swift */,
5D660FE91BE98D670021E04F /* Property.swift */,
ACF08B6626DD936200686CBC /* Query.swift */,
Expand Down Expand Up @@ -1791,6 +1796,7 @@
isa = PBXGroup;
children = (
023B19F71A423BD20067FB81 /* libc++.dylib */,
3FD6D1A82B4C9EFB00A4FEBE /* PrivacyInfo.xcprivacy */,
E81A1F621955FC9300FDED82 /* Realm-Info.plist */,
02E334C21A5F3C45009F8810 /* Realm.modulemap */,
);
Expand Down Expand Up @@ -2256,13 +2262,15 @@
files = (
5D659ED21BE04556006515A0 /* CHANGELOG.md in Resources */,
5D659ED51BE04556006515A0 /* LICENSE in Resources */,
3FD6D1A92B4C9EFB00A4FEBE /* PrivacyInfo.xcprivacy in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5D660FCA1BE98C560021E04F /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3FD6D1AC2B4CA56D00A4FEBE /* PrivacyInfo.xcprivacy in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
23 changes: 23 additions & 0 deletions Realm/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not have just one manifest for both frameworks? Also, I don't think is required to have it in the framework folder, and seems a little bit distracting to have this next to the implementation files.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPM requires it to be within the source root for the target.

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
</dict>
</array>
<key>NSPrivacyTracking</key>
<false/>
</dict>
</plist>
1 change: 1 addition & 0 deletions RealmSwift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Pod::Spec.new do |s|
s.dependency 'Realm', "= #{s.version}"
s.source_files = 'RealmSwift/*.swift', 'RealmSwift/Impl/*.swift', 'Realm/Swift/*.swift'
s.exclude_files = 'RealmSwift/Nonsync.swift'
s.resource_bundles = {'realm_swift_privacy' => ['RealmSwift/PrivacyInfo.xcprivacy']}

s.pod_target_xcconfig = {
'APPLICATION_EXTENSION_API_ONLY' => 'YES',
Expand Down
14 changes: 14 additions & 0 deletions RealmSwift/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array/>
<key>NSPrivacyTracking</key>
<false/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for adding this new schema to the installation examples project

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running the installation test locally was sometimes failing due to the App scheme not existing.

<Scheme
LastUpgradeVersion = "1510"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3FEC917D2A4D41250044BFF5"
BuildableName = "App.app"
BlueprintName = "App"
ReferencedContainer = "container:CocoaPods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3FEC917D2A4D41250044BFF5"
BuildableName = "App.app"
BlueprintName = "App"
ReferencedContainer = "container:CocoaPods.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3FEC917D2A4D41250044BFF5"
BuildableName = "App.app"
BlueprintName = "App"
ReferencedContainer = "container:CocoaPods.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>