Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
拍照允许我在BSImagePicker Swift ios中选择多个maxNumberOfSelections_Swift_Image_Swift3 - Fatal编程技术网

拍照允许我在BSImagePicker Swift ios中选择多个maxNumberOfSelections

拍照允许我在BSImagePicker Swift ios中选择多个maxNumberOfSelections,swift,image,swift3,Swift,Image,Swift3,这是我的密码 let vc = BSImagePickerViewController() vc.takePhotos = true vc.maxNumberOfSelections = 2 bs_presentImagePickerController(vc, animated: true, select: { (asset: PHAsset) -> Void in

这是我的密码


 let vc = BSImagePickerViewController()
    vc.takePhotos = true
    vc.maxNumberOfSelections = 2

    bs_presentImagePickerController(vc, animated: true,
                                    select: { (asset: PHAsset) -> Void in
                                        print("Selected: \(asset)")
    }, deselect: { (asset: PHAsset) -> Void in
        print("Deselected: \(asset)")
    }, cancel: { (assets: [PHAsset]) -> Void in
        print("Cancel: \(assets)")
    }, finish: { (assets: [PHAsset]) -> Void in
        print("Finish: \(assets)")
        print(assets.count)
        for i in 0..<assets.count
        {
            self.SelectedAssets.append(assets[i])
            print(self.SelectedAssets)
        }
    }, completion: nil)


设vc=BSImagePickerViewController()
vc.takePhotos=true
vc.maxNumberOfSelections=2
bs_presentImagePickerController(vc,动画:真,
选择:{(资产:阶段集)->Void in
打印(“选定:\(资产)”)
},取消选择:{(资产:PHAsset)->Void in
打印(“取消选择:\(资产)”)
},取消:{(资产:[PHAsset])->中的Void
打印(“取消:\(资产)”)
},finish:{(资产:[PHAsset])->中的Void
打印(“完成:\(资产)”)
打印(资产.计数)

对于0中的i.这似乎是
BSImagePickerViewController
中的一个错误,因为在使用
相机
呈现
imagePicker
时,没有检查最大选择数。因此,您可以通过在
PhotoViewController
第287行添加以下条件,在本地更改/解锁pod

    // Camera shouldn't be selected, but pop the UIImagePickerController!
    let isAllowedToTakePicture = (photosDataSource?.selections.count ?? 0) < settings.maxNumberOfSelections
    if let composedDataSource = composedDataSource , composedDataSource.dataSources[indexPath.section].isEqual(cameraDataSource), isAllowedToTakePicture {
        let cameraController = UIImagePickerController()
        cameraController.allowsEditing = false
        cameraController.sourceType = .camera
        cameraController.delegate = self

        self.present(cameraController, animated: true, completion: nil)
//不应选择相机,但应弹出UIImagePickerController!
让isAllowedToTakePicture=(PhotoDataSource?.selections.count±0)
您还可以分叉此库并使用此修复程序发出拉取请求,以便版主可以合并您的修复程序

上述修复将是临时的,如果您进行了
pod安装/更新
,它可能会再次出现,直到它未合并到原始库中