didFinishPickingMediaWithInfo没有被调用

塔尔·锡安

我有一个UITableViewCell按钮来拍摄图像并将其放回单元格中。当我调用UIImagePickerController并拍摄图像时,它不会调用以下委托:

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject], sender:AnyObject)

这是我takePhotoFunctionUITableViewController

@IBAction func takePhoto(sender: AnyObject) {
let imagePickerController = UIImagePickerController()
imagePickerController.delegate = self
imagePickerController.allowsEditing = true

let actionSheet = UIAlertController(title: "Choose image souruce", message: nil, preferredStyle: UIAlertControllerStyle.ActionSheet)

actionSheet.addAction(UIAlertAction(title: "Take Image", style: UIAlertActionStyle.Default, handler: { (alert:UIAlertAction!) -> Void in
    imagePickerController.sourceType = UIImagePickerControllerSourceType.Camera
    self.presentViewController(imagePickerController, animated: true, completion: nil)
}))

actionSheet.addAction(UIAlertAction(title: "Photo Library", style: UIAlertActionStyle.Default, handler: { (alert:UIAlertAction!) -> Void in
    imagePickerController.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
    self.presentViewController(imagePickerController, animated: true, completion: nil)
}))
actionSheet.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil))
self.presentViewController(actionSheet, animated: true, completion: nil)}
日本石油

Swift 3中,此委托方法现在称为:

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any])

不同之处在于:

  1. 选择器前下划线_
  2. 最后的信息类型从[String:AnyObject]更改[String:Any]

我遇到了同样的问题,当我进行这些更改时,它起作用了。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

我不确定为什么我的imagePickerController协调器没有触发didFinishPickingMediaWithInfo

来自分类Dev

didUpdateLocations没有被调用

来自分类Dev

没有调用MarshalJSON

来自分类Dev

没有调用DBResourceprovider

来自分类Dev

没有调用CssRewriteUrlTransform

来自分类Dev

pushPayload没有被调用

来自分类Dev

函数没有被调用

来自分类Dev

__callStatic没有被调用

来自分类Dev

didSelectRowAtIndexPath没有被调用

来自分类Dev

OnKillFocus没有被调用

来自分类Dev

controllerDidChangeContent没有被调用

来自分类Dev

didUpdatePushCredentials没有被调用

来自分类Dev

没有调用audioRecorderBeginInterruption

来自分类Dev

didBeginContact没有被调用

来自分类Dev

paintComponent没有被调用

来自分类Dev

didDisconnectPeripheral:没有被调用

来自分类Dev

preferredsStatusBarHidden没有被调用

来自分类Dev

ChangeNotifierProvider没有被调用

来自分类Dev

watchPosition没有被调用

来自分类Dev

DiagramListener没有被调用?

来自分类Dev

没有调用focusOutEvent

来自分类Dev

onAuthenticationSuccess没有被调用

来自分类Dev

didSelectRowAtIndexPath没有被调用

来自分类Dev

没有调用CssRewriteUrlTransform

来自分类Dev

没有调用webViewDidFinishLoading

来自分类Dev

ngChange没有被调用

来自分类Dev

没有调用subscriberCellularProviderDidUpdateNotifier

来自分类Dev

pushPayload没有被调用

来自分类Dev

没有调用audioRecorderBeginInterruption