[solved]iOS: loading a document from Mail app/Safari


#1

I have a Juce iOS project in which I registered a new Document type (and its associated UTI), I can see it’s working correctly by mailing to myself one of the app’s document:
When I click the attachment I can select “Open with…” and my app appears, but I didn’t find a way in Juce to know which file needs to be loaded (either at startup or in the resumed() callback).

It looks like this is achieved on OSX using anotherInstanceStarted but it doesn’t seem to be called on iOS.


#2

Bump, does anyone have a workaround for this ? I didn’t manage to find a way to achieve this with Juce…


#3

(Bump again, just in case someone with a solution didn't see the thread...)

 


#4

It's not clear from your post what it is that you're trying to do.  In any case I've registered UTI handlers in a couple of my apps.  When the app is started, they check in their document directory to see if any new documents have been copied there, because that's where mail will put them.  If you find any, you need to process them and if needs be you can copy the file into the apps library directory and delete the one in the document directory so it won't be processed again.


#5

Ok, I thought I would have to access the file name via a command-line argument, but indeed this method could work well.

 

Thanks for your help !

 


#6

Here's me again, I just wanted to ask: in which folder are you searching exactly ?

 

I tried to search in File::userDocumentsDirectory and File::userApplicationDataDirectory after using "Open in..." in the Mail app, but the file doesn't seem to be copied in any of those folders.

 


#7

They do show up under File::userDocumentsDirectory.  Something else must be going on... Here's the start of the function I'm using to import data:

void ImportExportManager::importUserData(bool showPopupWithImportResultIfNothingFound)
{
    Array<File> importedFiles;
    bool searchRecursively = true;
    String wildCardPattern = "*." USERDATA_FILE_EXTENSION;
    int numberOfH9ZFiles = File::getSpecialLocation(File::userDocumentsDirectory).findChildFiles(importedFiles, File::findFiles, searchRecursively, wildCardPattern);


#8

Thanks for your help ! My problem was just that I didn't search recursively.