使用未声明的类型'PHAsset'BSImagePicker [英] Use of undeclared type 'PHAsset' BSImagePicker

查看:68
本文介绍了使用未声明的类型'PHAsset'BSImagePicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从cocoaPods中快速导入了一个模块.我做了所有需要做的事情,它也可以工作,因为模块已成功导入.我现在想测试BSimagepicker的一些演示脚本,但是它说未声明的类型:PHAsset.

I imported a module from CocoaPods inside swift. i did everythings as it needs to be done and it also works, because the module is succesfully imported. i now want to test some demo script of BSimagepicker but it says undeclared type : PHAsset.

我需要做的是选择不同的图像,并将其加载到应用程序内的某种图像选择器预览中.

What i need to do is to select different images and load this into some sort of imagepicker preview inside the app.

有人可以帮助解决此错误吗?

Someone can help to fix this error?

@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

推荐答案

[由于我也在寻找答案,也找不到答案,因此我将其添加为答案,以便将来人们找到它更容易.感谢@Allen在评论中提供了答案.]

您必须通过编写以下内容添加照片框架:

You have to add the Photos Framework by writing:

import Photos

...在ViewController的源代码开头.
这样您就可以使用PHAsset.

...at the beginning of your ViewController's source code.
That will allow you to use PHAsset.

这篇关于使用未声明的类型'PHAsset'BSImagePicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆