详细问题描述
[内容]
在使用njs的时候(iOS)监听了
var delegate = plus.ios.implements('UIImagePickerControllerDelegate',
{'imagePickerController:didFinishPickingMediaWithInfo:':function(picker,info){
console.log('info:'+arguments.length);
plus.ios.invoke(arguments[0],'dismissViewControllerAnimated:completion:','YES',null);
}});
打印的参数长度为1,但是url在第二个参数中。选取相册的时候有三个参数,打印的结果还是只有一个参数。
重现步骤
[步骤]
[结果]想获取文件路径,oc如下
-
(void)imagePickerController:(UIImagePickerController )picker didFinishPickingMediaWithInfo:(NSDictionary )info
{
ALAssetsLibrary library = [[ALAssetsLibrary alloc] init];
NSURL recordedVideoURL= [info objectForKey:UIImagePickerControllerMediaURL];
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:recordedVideoURL]) {
[library writeVideoAtPathToSavedPhotosAlbum:recordedVideoURL
completionBlock:^(NSURL assetURL, NSError error){}
];
}[picker dismissViewControllerAnimated:YES completion:nil];
}
[期望] 期望能拿到第二个参数(info),从而获取文件路径
运行环境
[系统版本] mac OS 10.11.5
[浏览器版本]
[IDE版本] HBuilder 7.1.2.201605102311
[mui版本] HBuilder 7.1.2.201605102311
附件
[代码片段]
function fromCameraVedioIOS(){
var cameraVideo = plus.ios.newObject("UIImagePickerController");
plus.ios.importClass('NSDictionary');
var delegate = plus.ios.implements('UIImagePickerControllerDelegate',
{'imagePickerController:didFinishPickingMediaWithInfo:':function(picker){
console.log('info:'+arguments.length);
plus.ios.invoke(arguments[0],'dismissViewControllerAnimated:completion:','YES',null);
}});
cameraVideo.plusSetAttribute('delegate',delegate);
cameraVideo.plusSetAttribute('sourceType',1);
var iosArray = plus.ios.newObject('NSMutableArray');
plus.ios.invoke(iosArray,'addObject:','public.movie');
cameraVideo.plusSetAttribute('mediaTypes',iosArray);
cameraVideo.plusSetAttribute('videoMaximumDuration',10.000000000000001);
console.log('du:'+cameraVideo.plusGetAttribute('videoMaximumDuration'));
var UIApplicationClass = plus.ios.importClass("UIApplication");
var UIAppObj = UIApplicationClass.sharedApplication();
var del = plus.ios.invoke(UIAppObj,"delegate");
// console.log(JSON.stringify(del));
var appWindowObj = plus.ios.invoke(del,"window");
var appRootController = plus.ios.invoke(appWindowObj,"rootViewController");
plus.ios.invoke(appRootController,"presentViewController:animated:completion:",cameraVideo,"YES",null);
}
[安装包]真机
8***@qq.com
请问你程序闪退的问题决绝了吗
2018-02-24 15:48
首席劝退师
你获取到视频路径没
2018-08-24 15:23