我试图通过此链接https://www.npmjs.com/package/nativescript-mediafilepicker使用自定义文件代码,但出现此错误“找不到变量:IQMediaPickerControllerDelegate”
uploadFile(){
let extensions = [];
if (app.ios) {
extensions = [kUTTypePDF, kUTTypeText]; // you can get more types from here: https://developer.apple.com/documentation/mobilecoreservices/uttype
} else {
extensions = ['txt', 'pdf'];
}
let options: FilePickerOptions = {
android: {
extensions: extensions,
maxNumberFiles: 2
},
ios: {
extensions: extensions,
multipleSelection: true
}
};
let mediafilepicker = new Mediafilepicker();
mediafilepicker.openFilePicker(options);
mediafilepicker.on("getFiles", function (res) {
let results = res.object.get('results');
console.dir(results);
});
mediafilepicker.on("error", function (res) {
let msg = res.object.get('msg');
console.log(msg);
});
mediafilepicker.on("cancel", function (res) {
let msg = res.object.get('msg');
console.log(msg);
});
}
我希望我的移动应用程序能够通过单击一个调用自定义文件功能的按钮来打开文件选择器,但我得到:
"Can't find variable: IQMediaPickerControllerDelegate"