我正在使用objective-c 图像选择器图像选择器来选择时间间隔,但我正在迅速进行。我只能访问objective-c 代码,所以我使用了objective-c 到swift 转换器,但出现了错误。
func qb_imagePickerController(imagePickerController: QBImagePickerController, didFinishPickingAssets assets: [AnyObject]) {
for asset in assets as! [PHAsset] {
PHImageManager.defaultManager().requestAVAssetForVideo(asset, options: nil, resultHandler: {(avAsset: AVAsset, audioMix: AVAudioMix, info: [NSObject : AnyObject]) -> Void in
var url: NSURL = NSURL(string: "\(asset)")!
var avAsset: AVURLAsset = AVURLAsset(URL: url, options: nil)
var playerItem: AVPlayerItem = AVPlayerItem(asset: avAsset)
var videoPlayer: AVPlayer = AVPlayer(playerItem: playerItem)
videoPlayer.play()
})
}
self.dismissViewControllerAnimated(true, completion: { _ in })
}
这是我目前拥有的代码。我收到的错误如下。
无法将类型 '(AVAsset, AVAudioMix, [NSObject : AnyObject]) -> Void' 的值转换为预期的参数类型 '(AVAsset?, AVAudioMix?, [NSObject : AnyObject]?) -> Void'