jemur
October 26, 2018, 1:10am
1
My app uses a native file chooser. All is/was fine on iOS11. It continues to work just fine.
With the update to iOS 12 though, now FileChooser::isPlatformDialogAvailable() returns false on iOS12 devices.
Is there some new project configuration to be aware of to make this work on iOS12?
ed95
October 26, 2018, 8:05am
2
No, it should work as expected. I’ve just tried this with a device running iOS 12.0.1 and native FileChooser
s are working fine.
That method only returns false if the JUCE_DISABLE_NATIVE_FILECHOOSERS
flag is set - have you defined it somewhere?
jemur
November 2, 2018, 1:30am
3
What device did you try it on?
This is still an issue for me.
For me, it shows up on an iPhone 6s+, and an iPhone 7 which I recently updated to 12.0.1. It doesn’t show up on the 4 other iOS devices that I have which are also iOS 12. I have absolutely no idea why… it used to work just fine on those two devices before the upgrade.
ed95
November 2, 2018, 9:23am
4
I tested it on a 6s. I’ll try to get hold of one of those devices and test it out.
ed95
November 2, 2018, 10:22am
5
Newer devices are working fine for me too. Are you able to reproduce this with a simple test app? Here’s the PIP that I am using to test it out:
/*******************************************************************************
The block below describes the properties of this PIP. A PIP is a short snippet
of code that can be read by the Projucer and used to generate a JUCE project.
BEGIN_JUCE_PIP_METADATA
name: iOSNativeFileBrowser
vendor: JUCE
website: www.juce.com
dependencies: juce_core, juce_data_structures, juce_events, juce_graphics, juce_gui_basics
exporters: xcode_iphone
type: Component
mainClass: MyComponent
END_JUCE_PIP_METADATA
*******************************************************************************/
#pragma once
//==============================================================================
class MyComponent : public Component
{
public:
//==============================================================================
MyComponent()
{
addAndMakeVisible (showFileChooserButton);
showFileChooserButton.onClick = [this]
{
FileChooser chooser ("FileChooser");
if (chooser.browseForDirectory())
DBG (chooser.getResult().getFullPathName());
};
setSize (600, 400);
}
~MyComponent()
{
}
//==============================================================================
void paint (Graphics& g) override
{
g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
}
void resized() override
{
showFileChooserButton.centreWithSize (250, 35);
}
private:
//==============================================================================
TextButton showFileChooserButton { "Show file chooser" };
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MyComponent)
};
jemur
November 2, 2018, 10:24pm
6
I can confirm that with the above pip, it works just fine on an iPhone X and an iPad mini 2, and does not work on an iPhone 6s+ or an iPhone 7.
See screenshots - first is obviously the 6s+, second is the X.
jemur
November 21, 2018, 8:35pm
7
bool FileChooser::isPlatformDialogAvailable()
{
#if JUCE_DISABLE_NATIVE_FILECHOOSERS
return false;
#else
return [[NSFileManager defaultManager] ubiquityIdentityToken] != nil;
#endif
}
The native dialog should still be available for phone-located file browsing even if the iCloud is disabled, should it not ?!?! My problem, I determined, arose because I was not signed into iCloud on the 2 devices I mentioned (6s+ and 7). I didn’t realize this was a constraint to use the native dialog, but I am confused about why this constraint is in place. Can you clarify this for me?
ed95
November 23, 2018, 9:57am
8
No, the iOS native file browser requires iCloud to be enabled on the device and for the user to have logged in at least once.