iOS Native Content Sharing Halp Plz


I can’t get the native content sharing to work for the life of me. I am saving a .wav file to the security group, then I hit the bit of code I essentially copied straight from the demo projects. I verify that the write is correct and the file exists in the sample writing dialogue (just by way of pointing out that I’m still trying to get this to work and haven’t put in any idiot proofing yet.)

File tmpWave = tmpFile.getChildFile("temp.wav");
Array<URL> urls;
urls.add ({ tmpWave.getFullPathName() });
ContentSharer::getInstance()->shareFiles (urls, [] (bool success, const String& error)
		auto resultString = success ? String ("success") : ("failure\n (error: " + error + ")");
		AlertWindow::showMessageBoxAsync (AlertWindow::InfoIcon, "Sharing Files 
            Result","Sharing files finished\nwith " + resultString);

So the .wav file is correctly created and exists. When I step through with the debugger, I can see that the array urls has one item, and that item is the full path name to the .wav file. But when it gets to line 54 in juce_ios_ContentSharer.cpp, isLocalFile() returns false, so it goes through that next series of creation steps in the else. As you can see, it appears to do this correctly:

Then it appears to hit line 75, but the nativeFilePath isn’t changed from nil, thus ensuring a skip of line 81, which we need for the Share dialogue to work. As a result, it throws an assertion that I’m trying to share nothing.

Firstly, I’m following the example directly, in which the URL array for the constructor of the Sharing dialog is populated with Files. Now, I know from experience that that sort of frippery will work on macOS, but can be semi-hazardous on iOS. But how would I get a true URL to that File I just created, and would it matter?

Secondly, wtf?

In reading through the method for this, I think that we’re in another situation where, the way this is coded, it will work in standalone but not AUv3. Without a Files dialogue, an AUv3 can only write to the security group. The way the array is created in juce_ios_ContentSharer.cpp, it appears that it can only accept URLs from the main bundle or the file system, but not the security group. (pathForResource doesn’t recognize the path to the security group as valid, thus ensuring that the nativeFilePath remains nil.)

That being said, this will almost certainly assert later on (in the same manner than an AUv3 asserts if the third bool in a native saving dialog is false) because as it is written it isn’t owned by the Editor, but rather the view that contains it.

So, unless some intrepid soul wants to tackle this problem, I’ll just use a Files dialog, which I know works, albeit not as dope.