Trying to upload a file through my app but it says that I don't have access to the file:
In my plist:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>pdf file</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
</dict>
</array>
In AppDelegate:
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options{
/*When I try to upload here it returns an error saying that the
url is pointing to a private file*/
}
I believe if I registered the app to be shown as copy to' like email clients, and slack for example the problem would be solved. But I'm failing to find the right way to do it.
By changing the LSHandlerRank from owner to alternate did the trick of copy to but still gave me the privacy error:
Error Domain=NSCocoaErrorDomain Code=257 "The file “xyzd.pdf” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/private/var/mobile/Containers/Data/Application/42A9C8AD-4AE2-4F2E-91F0-C399719F19D4/Documents/xyz.pdf, NSUnderlyingError=0x282ec6460 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}