我從CocoaPods裏面導入了一個模塊。我做了所有事情,因爲它需要完成,它也可以工作,因爲模塊已成功導入。我現在想測試一些BSimagepicker的演示腳本,但它說未聲明的類型:PHAsset。使用未聲明的類型'PHAsset'BSImagePicker
我需要做的是選擇不同的圖像,並加載到應用程序內的某種imagepicker預覽。
有人可以幫助解決這個錯誤?
@IBOutlet var imageView: UIImageView!
@IBOutlet weak var PicLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//startbsimpagepicker
let vc = BSImagePickerViewController()
bs_presentImagePickerController(vc, animated: true,
select: { (asset: PHAsset) -> Void in
// User selected an asset.
// Do something with it, start upload perhaps?
}, deselect: { (asset: PHAsset) -> Void in
// User deselected an assets.
// Do something, cancel upload?
}, cancel: { (assets: PHAsset) -> Void in
// User cancelled. And this where the assets currently selected.
}, finish: { (assets: [PHAsset]) -> Void in
// User finished with these assets
}, completion: nil)
//endbsimpagepicker
您需要通過「導入照片」爲PHAsset導入Photos Framework – Allen
這就是訣竅!非常感謝。只有一件事:導入 },取消:{(assets:PHAsset) - >無效 //用戶取消。而這個資產目前選擇的地方。取消時出現錯誤。它說:不能將類型(PPHAsset)Void的值轉換爲預期的參數類型PHAsset _。空虛嗎? –
關於「cancel:{(assets:PHAsset) - >」我認爲應該是「取消:{(assets:[PHAsset]) - > Void in」。你錯過了代碼中的方括號。 – Allen