Document picker not working with publish iOS app
Problem
I am using DocumentPicker API to upload files. Its working well with android application, both with expo client and published apps. But for some reason, its not working with iOS platform. Do I need to define some permission or something??? I'm using sdk v20.0.0
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Configure iOS Permissions for Document Picker
The DocumentPicker API requires specific permissions to access files on iOS devices. Unlike Android, iOS enforces stricter privacy controls, and without the appropriate permissions defined in the app's Info.plist file, the DocumentPicker will not function as expected.
Awaiting Verification
Be the first to verify this fix
- 1
Update Info.plist for Permissions
You need to add the necessary permissions to your iOS app's Info.plist file. Specifically, you should include the NSDocumentDirectoryUsageDescription key to inform users why your app needs access to their documents.
xml<key>NSDocumentDirectoryUsageDescription</key> <string>This app requires access to your documents to upload files.</string> - 2
Rebuild the iOS App
After updating the Info.plist file, you need to rebuild your iOS app for the changes to take effect. Use the following command to rebuild your app with Expo.
bashexpo build:ios - 3
Test Document Picker Functionality
Once the app is rebuilt and installed on an iOS device, test the Document Picker functionality to ensure it is working as expected. Attempt to upload a file and check for any errors.
typescriptconst result = await DocumentPicker.getDocumentAsync(); - 4
Check for Additional Permissions
If the Document Picker is still not functioning, ensure that you have also requested any additional permissions that may be required, such as NSPhotoLibraryUsageDescription if accessing photos.
xml<key>NSPhotoLibraryUsageDescription</key> <string>This app requires access to your photo library.</string>
Validation
To confirm the fix worked, ensure that the Document Picker opens without errors and allows file selection on an iOS device. Check the console for any permission-related errors during the upload process.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep