Appcelerator Titanium-openFileChooserDialog不存在:如何打开对话框浏览文件

Appcelerator Titanium - openFileChooserDialog does not exist: How to open a dialog to browse for a file?

本文关键字:打开对话框 浏览 文件 Titanium-openFileChooserDialog 不存在 Appcelerator      更新时间:2024-03-03

我目前有以下代码:

function openFileChooser() {
    var options = {
        title : "Select file to upload to cloud...",
        types : ['mp3', 'm4a', 'aac', 'wav', 'aif', 'aiff'],
        typesDescription : "Audio files",
        path : Ti.Filesystem.applicationDataDirectory
    };
    //does not work
    Ti.UI.openFileChooserDialog(function(filenames) {
        fileSelected = filenames[0];
    }, options);
    $.filePath.text = fileSelected;
}

基本上,我试图打开一个对话框,让用户可以浏览音频文件。我在几个网站上看到过openFileChooserDialog的例子,但我的应用程序在运行时崩溃,声明它不存在。

在打开对话框供用户浏览音频文件的地方,我能做些什么吗?

openFileChooserDialog是TiteSDK剥离的Titanium Desktop API的一部分。如果这是一个移动项目,那么API调用在移动空间中不存在。