2016-09-20 3 views
1

私はDKImagePickerを複数の画像や動画に使用しています。私はイメージを取得していますが、ビデオをフェッチする方法はありません。
これまでに試したことを以下に示します。
ご案内しています。DKAssetsからビデオを取得する

func setImage() 
{   
    let pickerController = DKImagePickerController() 
    pickerController.showsCancelButton = true 
    pickerController.showsEmptyAlbums = false 

    pickerController.didSelectAssets = { (assets: [DKAsset]) in 
     print("didSelectAssets") 

     self.assets1 = assets 
     print(assets.count) 

     for asset in assets { 
      asset.fetchImageWithSize(PHImageManagerMaximumSize, completeBlock: { image, info in 
       if let img = image { 
        // let fixOrientationImage=img.fixOrientation() 

        User.sharedInstance.arrRoomGalleryImages.addObject(img) 
        print("array after selecting images and videos", User.sharedInstance.arrRoomGalleryImages) 

        kAppDelegate.imageSelected = true 
       } 
      }) 
     } 

    } 
    if(!(kAppDelegate.imageSelected)) 
    { 
     self.presentViewController(pickerController, animated: true)  {} 
    } 
} 
+0

は私の答えそれは構文エラー –

答えて

0

動画を取得するには、DKAssetにisVideoプロパティがあります。それを利用する。

for asset in self.assets { 
    if asset.isVideo == true { 
    asset.fetchAVAsset(.None, completeBlock: { video, info in 

    }) 
    } else { 
    asset.fetchImageWithSize(PHImageManagerMaximumSize, completeBlock: { image, info in 
      if let img = image { 
       // let fixOrientationImage=img.fixOrientation() 

       User.sharedInstance.arrRoomGalleryImages.addObject(img) 
       print("array after selecting images and videos", User.sharedInstance.arrRoomGalleryImages) 

       kAppDelegate.imageSelected = true 
      } 
     }) 
    } 
} 
+0

をチェック! –

+0

を与えている –

+0

どのような構文エラーを与える構文エラー –

関連する問題