SWIFT 4.2 imagePickerController problem

Trying to pass the chat client from swift 4 to swift 4.2 and using the selector I found trouble.

UIImagePickerControllerEditedImage //Unable to use index type as “UIImagePickerController.InfoKey” type'[String: Any]’ subscript

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

if let pickedImage = info[UIImagePickerControllerEditedImage] as? UIImage {
self.userProfileImage.contentMode = .scaleAspectFit
self.userProfileImage.image = pickedImage
}

picker.dismiss(animated: true, completion: nil)
}

The method signature has been changed to

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

You should see a warning with the name of func Message

Instance method
‘imagePickerController(:didFinishPickingMediaWithInfo:)’ nearly
matches optio nal requirement
‘imagePickerController(
:didFinishPickingMediaWithInfo:)’ of protocol
‘UIImagePickerControllerDelegate’

Candidate has non-matching type'(UIImagePickerController, [String :
Any] ) -> ()’

Move’imagePickerController(_:didFinishPickingMediaWithInfo:)’ to
another extension to silence this warning

Make’imagePickerController(_:didFinishPickingWithInfo:)’ private
to silence this warning

Requirement’imagePickerController(_:didFinishPickingMediaWithInfo:)’ declared here (UIKit.UIImagePickerControllerDelegate)

Trying to pass the chat client from swift 4 to swift 4.2 and using the selector I found trouble.

UIImagePickerControllerEditedImage //Cannot use type with index type “UIImagePickerController.InfoKey”‘[String :Any]’subscript

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

if let pickedImage = info[UIImagePickerControllerEditedImage] as? UIImage {< br /> self.userProfileImage.contentMode = .scaleAspectFit
self.userProfileImage.image = pickedImage
}

picker.dismiss(animated: true, completion: nil)
}

The method signature has been changed to

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

You should see a warning message with the name of func

Instance method
‘imagePickerController(:didFinishPickingMediaWithInfo :)’ nearly
matches optional requirement
‘imagePickerController(
:didFinishPickingMediaWithInfo:)’ of protocol
‘UIImagePickerControllerDelegate’

Candidate has non-matching type'(UIImagePickerController, [String :
Any]) -> ()’

Move’imagePickerController(_:didFinishPickingMediaWithInfo:)’ to
another extension to silence this warning

Make ‘ imagePickerController(_:didFinishPickingMediaWithInfo:)’ private
to silence this warning

Require ment ‘imagePickerController(_:didFinishPickingMediaWithInfo:)’ declared here (UIKit.UIImagePickerControllerDelegate)

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4096 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.