I'm a beginner to swift 3 and cocoapods and i want to implement this https://github.com/luowenxing/MTImagePicker image picker for my project.
I've installed the pod into my project and am using the .xcworkspace file.
However, I'm facing problems as i've errors like:
- No such module 'MTImagePicker'
- Use of unresolved identifier 'MTImagePickerController'
- Use of undeclared type 'MTImagePickerAssetsModel'
I've moved the MTImagePicker folder into my project as instructed.
But I'm still having this problem.
Any help is much appreciated.
Thank you so much!
Edited:
Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'BPMatters' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for BPMatters
source 'https://github.com/CocoaPods/Specs.git'
pod 'MTImagePicker', '~> 1.0.1'
target 'BPMattersTests' do
inherit! :search_paths
# Pods for testing
end
target 'BPMattersUITests' do
inherit! :search_paths
# Pods for testing
end
end
@objc protocol MTImagePickerControllerDelegate:NSObjectProtocol {
// Implement it when setting source to MTImagePickerSource.ALAsset
optional func imagePickerController(picker:MTImagePickerController, didFinishPickingWithAssetsModels models:[MTImagePickerAssetsModel])
// Implement it when setting source to MTImagePickerSource.Photos
@available(iOS 8.0, *)
optional func imagePickerController(picker:MTImagePickerController, didFinishPickingWithPhotosModels models:[MTImagePickerPhotosModel])
optional func imagePickerControllerDidCancel(picker: MTImagePickerController)
}
///third party image picker////
func thirdPartyImagePicker(){
let imagePicker = MTImagePickerController.instance
imagePicker.mediaTypes = [MTImagePickerMediaType.Photo,MTImagePickerMediaType.Video]
imagePicker.imagePickerDelegate = self
imagePicker.maxCount = 10 // max select count
imagePicker.defaultShowCameraRoll = true // when set to true would show Camera Roll Album like WeChat by default.
//default is MTImagePickerSource.ALAsset
imagePicker.source = MTImagePickerSource.ALAsset
//imagePicker.source = MTImagePickerSource.Photos (Work on iOS8+)
self.presentViewController(imagePicker, animated: true, completion: nil)
}
///third party image picker end///
Screenshot of Terminal after pod install
Solution: I got my stuffs working by doing this: https://stackoverflow.com/a/39435421/7498313
I marked Faris Sbahi's answer as the correct answer as I believe his answers can help beginners like me to set up the cocoapods and implementation of the project.
Thank you so much! :)