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

iOS privacy manifest #1232

Open
gabrielguilhoto opened this issue Mar 22, 2024 · 14 comments
Open

iOS privacy manifest #1232

gabrielguilhoto opened this issue Mar 22, 2024 · 14 comments

Comments

@gabrielguilhoto
Copy link

Starting May 1, Apple will require iOS submissions to the App Store to have privacy manifests describing the use of required reason APIs: https://developer.apple.com/news/?id=3d8a9yyh.

I used a script to find required reason APIs in our project and it pointed to 4 uses by react-native-fs in the RNFSManager.m file, at least in version 2.19.0:

  • NSFileCreationDate
  • NSFileModificationDate
  • NSFileSystemFreeSize
  • NSFileSystemSize

Could you please add the required privacy manifest?

@gkasireddy202
Copy link

How to download sh required_reason_api_scanner.sh YourAppDirectory and run in your react-native project?

@gabrielguilhoto
Copy link
Author

How to download sh required_reason_api_scanner.sh YourAppDirectory and run in your react-native project?

You can clone the https://github.com/Wooder/ios_17_required_reason_api_scanner repository to be able to run it.

@gkasireddy202
Copy link

@gabrielguilhoto - Thanks for your reply.

@gkasireddy202
Copy link

@gabrielguilhoto - After I cloned the git on my desktop.Getting error.
sh required_reason_api_scanner.sh Desktop

sh: required_reason_api_scanner.sh: No such file or directory

@WilliamWelsh
Copy link

@gabrielguilhoto - After I cloned the git on my desktop.Getting error. sh required_reason_api_scanner.sh Desktop

sh: required_reason_api_scanner.sh: No such file or directory

If you cloned it on your desktop then there is no folder called Desktop... you would just put ....

@gkasireddy202
Copy link

@WilliamWelsh - Thanks it is working. Is it mandatory to update every library for iOS privacy manifest?

@birdofpreyru
Copy link

Yeah... should I mention it once again, #1197 — The future of react-native-fs?
You probably should migrate to my fork of the lib, and file new issues, do any contributions in there.

@gkasireddy202
Copy link

I am using react-native-fs:2.20.0.
Can I update this library for the iOS privacy manifest file?

@stami
Copy link

stami commented Apr 8, 2024

I have no use for disk space APIs so I removed them with patch-package:

diff --git a/node_modules/react-native-fs/RNFSManager.m b/node_modules/react-native-fs/RNFSManager.m
index 5ddd941..80fb3e9 100755
--- a/node_modules/react-native-fs/RNFSManager.m
+++ b/node_modules/react-native-fs/RNFSManager.m
@@ -726,24 +726,11 @@ + (BOOL)requiresMainQueueSetup
 {
   unsigned long long totalSpace = 0;
   unsigned long long totalFreeSpace = 0;
-
-  __autoreleasing NSError *error = nil;
-  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-  NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error:&error];
-
-  if (dictionary) {
-    NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
-    NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
-    totalSpace = [fileSystemSizeInBytes unsignedLongLongValue];
-    totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
-
-    resolve(@{
-      @"totalSpace": [NSNumber numberWithUnsignedLongLong:totalSpace],
-      @"freeSpace": [NSNumber numberWithUnsignedLongLong:totalFreeSpace]
-    });
-  } else {
-    [self reject:reject withError:error];
-  }
+  // Remove disk space APIs to not to trigger NSPrivacyAccessedAPICategoryDiskSpace for privacy manifest
+  resolve(@{
+    @"totalSpace": [NSNumber numberWithUnsignedLongLong:totalSpace],
+    @"freeSpace": [NSNumber numberWithUnsignedLongLong:totalFreeSpace]
+  });
 }
 
 

@MianSaad705
Copy link

@gabrielguilhoto @gkasireddy202 Have You found any workaround for this or do we have to manually add the reason in PrivacyInfo.xcprivacy under this API Type NSPrivacyAccessedAPICategoryFileTimestamp.

@gkasireddy202
Copy link

Have You found any workaround for this or do we have to manually add the reason in PrivacyInfo.xcprivacy under this API Type NSPrivacyAccessedAPICategoryFileTimestamp.

I added this API reason in PrivacyInfo.xcprivacy file in my app.

@MianSaad705
Copy link

MianSaad705 commented Apr 24, 2024

@gkasireddy202 Under this API NSPrivacyAccessedAPICategoryFileTimestamp?
Secondly after adding apple approved your app without any warnings?
Kindly mention which reason you add

  • DDA9.1
  • C617.1
  • 3B52.1
  • 0A2A.1

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

@gkasireddy202
Copy link

@MianSaad705 - I added the below API type and reason in my app privacy file.I did not get any warning emails from Apple and also app is approved.

NSPrivacyAccessedAPIType
NSPrivacyAccessedAPICategoryFileTimestamp
NSPrivacyAccessedAPITypeReasons

C617.1

@MianSaad705
Copy link

@gkasireddy202 Thanks.

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

No branches or pull requests

6 participants