5
스위프트가 포함 된 iOS 8의 ALAsset에서 이미지 자산을 가져오고 싶습니다.IOS 스위프트 assetForURL 오류
나는 여러 이미지를 선택하기 위해 SNImagePicker를 사용합니다. 목표 - C와
내가이 사용 SWIFT와
for (int i = 0; i < info.count; i++) {
ALAssetsLibrary *assetLibrary=[[ALAssetsLibrary alloc] init];
[assetLibrary assetForURL:info[i] resultBlock:^(ALAsset *asset) {
UIImage *image = [UIImage imageWithCGImage:[asset aspectRatioThumbnail]];
} failureBlock:^(NSError *error) { }];
를, 내가이 일을 시도했다 :
이 조각으로Type 'CVarArg' does not conform to protocol 'NilLiteralConvertible'
func imagePicker(imagePicker: SNImagePickerNC!, didFinishPickingWithMediaInfo info: NSMutableArray!){
var i: Int = Int(0);
for (i; i < info.count as Int; i++){
var url: NSURL = info[i] as NSURL
var assetLibrary: ALAssetsLibrary = ALAssetsLibrary()
//
//assetLibrary.assetForURL(NSURL?(), resultBlock: ALAssetsLibraryAssetForURLResultBlock?(), failureBlock: ALAssetsLibraryAccessFailureBlock?())
//
assetLibrary.assetForURL(url, resultBlock: {
(asset: ALAsset!) in
if asset != nil {
var assetRep: ALAssetRepresentation = asset.defaultRepresentation()
var iref = assetRep.fullResolutionImage().takeUnretainedValue()
var image = UIImage(CGImage: iref)
self.imageViewPreview.contentMode = UIViewContentMode.ScaleAspectFill
self.imageViewPreview.image = image
}
}, failureBlock: {
(error: NSError!) in
NSLog("Error!", nil)
}
)
}
}
를, 나는 오류를 얻을 수
어느 라인 오류의 원인이? – RaffAl