1 Reply
      Latest reply on Sep 24, 2019 11:24 PM by ;';
      ;'; Level 1 Level 1 (0 points)

        When we use action extension with iOS13 Mail app, we don’t get the file url of the selected file. Instead we get it as _NSItemProviderSandboxedResource.

         

        The action extension works with other apps like DropBox(PDF) , Photos(PNG) etc but only with Mail it doesn’t.

         

         

          

        guard let inputItem = self.extensionContext?.inputItems.first as? NSExtensionItem, let provider = inputItem.attachments?.first else {
                 
                    return
                }
               
                if let typeIdentifier = provider.registeredTypeIdentifiers.first {
                    provider.loadItem(forTypeIdentifier: typeIdentifier, options: nil, completionHandler: { [weak self] (fileURL, error) in
                       
                        OperationQueue.main.addOperation({
                           
                            print(fileURL as Any)
                            guard let fileURL = fileURL as? URL else {
                                 
         here                        ///On iOS13 mail app Its not a file URL. HOW Do we handle this  . We get _NSItemProviderSandboxedResource
                               
                                //This is not an URL
                                fatalError()
                            }
                            print(fileURL)
                       //fileURL is proper in iOS12
                        })
                    })
                }