我必须拍摄捕获的图片网址。始终@media screen and (max-width:990px) {
#workd .thumb, #workd .description {
float: none;
margin: 0 auto;
text-align: center;
}
.col-xs-12.col-md-8.description.block.more { padding-left:0; }
}
返回nil。问题是didFinishPickingMediaWithInfo nil,我的要求是我需要获取捕获图像的URL。
这是我的代码。
didFinishPickingMediaWithInfo
这里 func captureNewImage() {
if UIImagePickerController.isSourceTypeAvailable(.Camera) {
let imagePickerController = UIImagePickerController()
imagePickerController.sourceType = .Camera
imagePickerController.cameraCaptureMode = .Photo
imagePickerController.mediaTypes = [kUTTypeImage as String]
imagePickerController.delegate = self
presentViewController(imagePickerController, animated: true, completion: nil)
}
else {
print("Camera is not available")
}
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
print(info); // return values see below
print(info[UIImagePickerControllerReferenceURL]) //return nill - problem here
if (picker.cameraCaptureMode == .Photo){
let imageUrl = info[UIImagePickerControllerReferenceURL] as! NSURL
let imageName = imageUrl.lastPathComponent
let documentDirectory = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first as String!
let photoURL = NSURL(fileURLWithPath: documentDirectory)
let localPath = photoURL.URLByAppendingPathComponent(imageName!)
let image = info[UIImagePickerControllerOriginalImage]as! UIImage
let data = UIImagePNGRepresentation(image)
self.selectedVideoFilePath = info[UIImagePickerControllerReferenceURL] as! NSURL
CustomPhotoAlbum.sharedInstance.saveImage(self.selectedVideoFilePath)
}else{
self.selectedVideoFilePath = info[UIImagePickerControllerMediaURL] as! NSURL
CustomPhotoAlbum.sharedInstance.saveVideo(self.selectedVideoFilePath)
}
dismissViewControllerAnimated(true) { () -> Void in
self.performSegueWithIdentifier("ShowMetaDataSegue", sender: self)
}
}
param返回
info
真的无法找到获取图片网址的方法。
建议任何解决方案,可能是我错过了这里的任何功能。
提前致谢