Greg, I noticed your file sharing switch was off, and it still worked.
I copied your plist additions over and modified it for my app, and now it works.
Interestingly though… previously I could tap on the file and it would open. This doesn’t happen now, rather I get a “preview” and have to tell it to open in my app. I think that’s because your plist didn’t have the OpenInPlace flags, where my previous one did.
I’m going to test that out again later today and see if it was the problem.
Thanks for all the effort you put into this. I really appreciate it.
as soon as I add LSSupportsOpeningDocumentsInPlace = TRUE into the plist the behavior with file not being available returns.
Not sure if this is a bug or if there is more that needs to go into the apps capabilities or entitlements or …
I can live without it opening in place.
What’s interesting is that almost every tutorial I’ve found about how to do this tells you to set that key to False. Makes me wonder if there’s a bug there that Apple won’t or can’t fix.
The other possibility is that the URL you were getting was actually a security scoped bookmark. If that’s the case there are other things you have to do to get access to them.
LSSupportsOpeningDocumentsInPlace (Boolean - iOS) When set to a value of YES, enables your app to open the original document from a file provider, rather than a copy of the document. The app can access documents from the system’s local file provider, the iCloud file provider, and any third-party File Provider extensions that support opening documents in place.
This is killing me again. Pulling my last hair out!
It seems that I can open a document when I tap on it from mail.
I cannot from messages, but I can save it in my files, and from files I can tap on it to (try) to open it in my app. However I cannot access the file from the URL.
From the app.handleURL I’m doing the following:
Var file As FolderItem = New FolderItem( url, folderitem.PathModes.URL )
file.exists is always false when I open from files.
it comes up as file:///private/var/mobile/…
I assumed that a url from the format, but also from the function name HandleURL.
It also OpenInPlace = false
These issues are always tricky when you can only see the issues on the hardware, but we can’t debug on the hardware. It’s a time vampire. I wish there was a remote debugger for iOS, but I’m pretty sure that would be impossible from a security perspective.
If the url starts with file:/// then yes it is the PathModes.URL is correct.
Do you have iOSKit from Jason King in your App?
If you do, calling NSURL.StartAccessingSecurityScopedResource might help.
Then read the data and make a new file in your App sandbox
Finally call NSURL.StopAccessingSecurityScopedResource
I can try that.
But I just looked in the console and I see this error.
Sandbox: SpotOn Color(579) deny(1) file-read-metadata /private/var/mobile/Containers/Shared/AppGroup/A077269F-BD1A-4AD7-BDA8-BF040E9F12FF/File Provider Storage/chris test 2.soj
What I’m doing getting a reference to the file, then copying it to a temporary location to work with it. I figure this should work regardless of the OpenInPlace true/false flag.
Since you now have a error message when opening it might be time to search stack overflow or the Apple dev forums. There is probably someone else who had the same error and might have a solution. We can help convert whatever switch/obj-c to Xojo if you find a solution
Does anyone have a simple example of this working? I’d love to try to reverse engineer the difference between a working project and mine.
I’ve done everything I can imagine and it just won’t behave.
It’s funny, reading a file into my software is something I’ve taken for granted for so long, to now lose this much time trying to do it is really hard to stomach.
I don’t know how the security scoped book mark part works but you don’t need to create the CFStringRef like that. String and Text types are automatically converted for you if you pass them into a function expecting a CFStringRef. The crash you are getting is a little weird since normally that means something isn’t being allocated. Can you try to do