On IOS15 beta 8 (not sure of other versions) if I open a PDF from the Files App from a document stored in the One My iPad folder, then use the Open in... or Share button to send to my app, dataWithContentsOfURL always returns nil. Is this a known problem?
Not all the apps have a problem opening the file. Chrome has a problem but Apple Mail doesn't.
Thanks
data = [NSData dataWithContentsOfURL:url];
Why would my app not have permission to view the document when it's from the files app?
Error Domain=NSCocoaErrorDomain Code=257 "The file “afile.pdf” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/private/var/mobile/Containers/Shared/AppGroup/xxxxxxxx/File Provider Storage/afile.pdf, NSUnderlyingError=0x281f4f150 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
Why would my app not have permission to view the document when it's from the files app? Sandboxed apps (meaning all the usual apps we developers create) do not have permissions to access documents of other apps.