IOS上代码是这样。
ALAssetsLibrary *assets Library = [[ALAssetsLibrary alloc]init];
[assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
.......
}]
使用native.js
var ALAssetsLibrary = plus.ios.importClass("ALAssetsLibrary");
var assets = new ALAssetsLibrary();
assets.enumerateGroupsWithTypesusingBlock('ALAssetsGroupAll', function(group, stop) {
})
会提示没有 enumerateGroupsWithTypesusingBlock 。是当前native.js不支持此api调用吗?
3 个回复
DCloud_IOS_XTY
好像iOS API没有这个方法吧?
anke (作者)
有这样的api, https://developer.apple.com/library/ios/documentation/AssetsLibrary/Reference/ALAssetsLibrary_Class/
改成 assets.enumerateGroupsWithTypesusingBlockfailureBlock('ALAssetsGroupAll', function(group, stop) {
console.log(group) // is null;
});
像usingBlock:^(ALAssetsGroup group, BOOL stop) 写出 function(group, stop) { } 没有错吧?怎么读取ios相册?
DCloud_IOS_XTY
这么写没错iOS block参数传递目前还不支持
2015-07-20 17:44
anke (作者)
那这样目前只能用插件的方式来做了?
2015-07-20 17:57
ngkeny
问题解决了吗?