Hi,
Firstly, I realise we don’t have access to paths outside our sandbox area of our app. However please read on.
We are trying to use the free DocPicker plugin (for iOS) developed by the Scott Harrison which is available here:
https://marketplace.coronalabs.com/corona-plugins/doc-picker
It’s downloading the file perfectly.
However we are having trouble copying the downloaded file to our apps sandbox area (eg, system.DocumentsDirectory)
For example, the full path (which is a ‘security scoped’ path) of the downloaded file is:
file:///private/var/mobile/Containers/Data/Application/80D73BC6-DBBF-4025-A91F-97B2CFBE1F19/tmp/docpickertest/test.txt
The above path is OUTSIDE the sandbox area of our app. So the document is on the device which is great but when I try to copy the file, it’s not so great.
In order to gain access to a path outside the apps sandbox, I’ve come across this document from Apple of how to get access to a security scoped path.
https://developer.apple.com/documentation/foundation/nsurl/1417051-startaccessingsecurityscopedreso
If that is the issue, then how would I call the method outlined in the above Apple doc? Is it possible to call a native method from lua rather than create a plugin? Has any other Corona devs had to call this method in the past / currently? Are you currently using the DocPicker plugin and able to copy the file to your sandbox directory even?
Any experience around this would be greatly appreciated.
Norm.
Scott, the plugin developer just added that method today / yesterday. I’ll give it a test shortly. If you read this Scott, thanks very much once again for looking into the problem.