0

I have a drawing app, and due to some heavy structural change (mostly PencilKit) I'm implementing a brand new app for version 2. Documents created by version 1 will be read-only in version 2.

I've implemented UIActivityViewController in both versions so I can successfully move a document from version 1 to version 2. What I'd like to do though is offer another option of directly opening a version 1 document in version 2 without the activity view controller popping up. I'm sharing via file URL, and I see how to implement opening an app via URL scheme, but I'm not sure if I can open via URL scheme AND have the URL be both a custom scheme and also a file reference.

2
  • You can do it. You’ll need to issue a final version of the old app which knows how to export the data to the new app. Marvin and GoodReader are cases in point; they both went through this sort of transition. Commented Mar 11, 2020 at 15:31
  • @matt That's encouraging... any idea how to implement? I had planned on a final version of the old app for just that reason, or at least a pop-up about the new version with a link to the App Store. I've found all sorts of info on either UIActivityViewController OR sending simple text via custom URL... just not files via custom URL. Commented Mar 11, 2020 at 15:33

1 Answer 1

1

I was able to get this to work by using an AppGroup containing both my old & new applications. That gave me a shared area to save & retrieve files. Once I registered both apps with the app group in Xcode, I could write files to the shared directory like this:

    if let sharedURL = fileManager.containerURL(forSecurityApplicationGroupIdentifier: "group.mycompany.appgroupname") {   <read or write the files in here> }

I then opened a custom URL which contained the path to the file, or the term "ALL_FILES" for example, "myapp://private/where/apple/put/my/files/file1.ext". or "myapp://ALL_FILES" and the new app would parse the URL to decide what to do.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.