Search code examples
javascriptmacostitaniumtidesdk

Appcelerator's `Titanium.UI.openFileChooserDialog` Fails in TideSDK


On OSX, I have an old Appcelerator Titanium app, that I want to migrate it to the new TideSDK platform.

Now, I can:

  • download and install TideSDK (https://github.com/TideSDK/TideSDK/downloads -> TideSDK-Developer-1.4.2-osx-x86-64.dmg and TideSDK-1.3.1-beta-osx-x86-64.zip)
  • open my current appcelerator project with TideSDK
  • and i) Launch The App and ii) Package With Runtime (then launch)

But an invocation to Titanium.UI.openFileChooserDialog(parseCsvFile,options); doesn't do anything. Below is what the current code looks like. How can I get a Dialog FileChooser invoked in TideSDK ?

function selectFile() {
  var options = {
    multiple    : false,
    title   : "Open file",
    types   : ['csv', 'txt'],
    typesDescription  : "CSV files",
    path    : Titanium.Filesystem.getUserDirectory()
  }

  Titanium.UI.openFileChooserDialog(parseCsvFile,options);
}

Thanks


Solution

  • The correct command needs to happen from within a window, like this:

    Ti.UI.currentWindow.openFileChooserDialog(function(e) {
        // Do stuff after the user has closed the dialog here
        ...
    
    }, { // Specify options
        multiple: false,
        title   : "Open file",
        types   : ['csv', 'txt'],
        path    : Ti.Filesystem.getUserDirectory()
    });