After dismiss the imagePickerController, how to go back to the current tab instead of the default tab - uitabbarcontroller

I have 4 tabs in the tab bar. Currently, I am working in the 4th tab, and having an imagePickerController. After the imagePickerController dismissed, it goes to the default tab (1st tab). How can I make it go to the current (4th) tab?
class EditMyPostViewController: UIViewController {
#IBOutlet weak var postImageView: UIImageView!
let imagePicker = UIImagePickerController()
override func viewDidLoad() {
super.viewDidLoad()
imagePicker.delegate = self
}
#IBAction func updatePhotoTapped(_ sender: Any) {
let alert = UIAlertController(title: "Add a picture", message: "How do you want to upload the picture?", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Take Photo", style: .default, handler: { action in
self.takePhotoWithCamera()
}))
alert.addAction(UIAlertAction(title: "Use Existing Photo", style: .default, handler: { action in
self.getPhotoFromLibrary()
}))
self.present(alert, animated: true)
}
}
extension EditMyPostViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func takePhotoWithCamera() {
if (!UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.camera)) {
let alertController = UIAlertController(title: "No Camera", message: "The device has no camera.", preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .default, handler: nil)
alertController.addAction(okAction)
present(alertController, animated: true, completion: nil)
} else {
imagePicker.allowsEditing = false
imagePicker.sourceType = .camera
present(imagePicker, animated: true, completion: nil)
}
}
func getPhotoFromLibrary() {
imagePicker.allowsEditing = false
imagePicker.sourceType = .photoLibrary
present(imagePicker, animated: true, completion: nil)
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
dismiss(animated: true, completion: nil)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage
{
postImageView.image = image
}
dismiss(animated: true, completion: nil)
}
}
The imagePicker is present in the 2 functions takePhotoWithCamera() and getPhotoFromLibrary().
In the last function, I tried to dismiss(animated: true, completion: nil), but it goes to the default tab instead of the current tab. How can I present the current ViewController?
I tried
present(self, animated: true, completion: nil)
But it will cause an Exception: Application tried to present modally an active controller

Related

Creating an image format with an unknown type is an error UIImagePickerController() , unexpectedly found nil

Swift Version 3
Xcode Version 8.3.3 (8E3004b)
This question has been asked and answered before. Yet, I cannot find a way fix this error.
"Creating an image format with an unknown type is an error" with UIImagePickerController
When a new picture is selected from Photo Library, I get this error
Generic Creating an image format with an unknown type is an error.
I select the photo and when I tap choose, I get error in func takePhoto where I do this assignment self?.imgView.image = newImage
fatal error: unexpectedly found nil while unwrapping an Optional value
Printing description of newImage: expression produced error: error:
/var/folders/s0/xq_zc7l56m1__n1qjk29p6tw0000gn/T/./lldb/2631/expr1.swift:1:80:
error: use of undeclared type 'UIKit'
Swift._DebuggerSupport.stringForPrintObject(Swift.UnsafePointer>(bitPattern:
0x118055200)!.pointee)
^~~~~
typealias imagePickerHelperCompletion = ((UIImage?) -> Void)!
class ImagePickerHelper: NSObject {
weak var viewController: UIViewController!
var cameraFlashMode: UIImagePickerControllerCameraFlashMode //flash, no flash
var photoLibraryIsVisible: Bool
var cameraDevice: UIImagePickerControllerCameraDevice //front, back camera
var completion: imagePickerHelperCompletion
init(viewController: UIViewController, cameraFlashMode:UIImagePickerControllerCameraFlashMode, photoLibraryIsVisible: Bool,cameraDevice: UIImagePickerControllerCameraDevice, completion: imagePickerHelperCompletion) {
self.viewController = viewController
self.completion = completion
self.cameraFlashMode = cameraFlashMode
self.photoLibraryIsVisible = photoLibraryIsVisible
self.cameraDevice = cameraDevice
//super.init() implemented by subclasses to initializer a new object (the receiver) immediately after memory has been allocated
super.init()
self.showPhotoSourceSelection()
}
//show camera or photo library
func showPhotoSourceSelection() {
let actionSheet = UIAlertController(title: "Take new photo", message: "Would you like to open \n Camera or Photo Library?", preferredStyle: .actionSheet)
let cameraAction = UIAlertAction(title: "Camera", style: .default) { (action) in
self.showImagePicker(sourceType: .camera)
}
let photoLibraryAction = UIAlertAction(title: "Photo Library", style: .default) { (action) in
self.showImagePicker(sourceType: .photoLibrary)
}
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) { (action) in }
actionSheet.addAction(cameraAction)
if photoLibraryIsVisible == true { actionSheet.addAction(photoLibraryAction) }
actionSheet.addAction(cancelAction)
viewController.present(actionSheet, animated: true, completion: nil)
}
func showImagePicker(sourceType: UIImagePickerControllerSourceType) {
let imagePicker = UIImagePickerController()
imagePicker.allowsEditing = true //user can crop the image, or do some editing
imagePicker.sourceType = sourceType
imagePicker.mediaTypes = [kUTTypeImage as String]
imagePicker.delegate = self
if imagePicker.sourceType == .camera {
imagePicker.cameraFlashMode = cameraFlashMode
imagePicker.cameraDevice = self.cameraDevice
}
viewController.present(imagePicker, animated: true, completion: nil)
}
}//end of class
extension ImagePickerHelper: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
viewController.dismiss(animated: true, completion: nil)
}
//if user did take a photo
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
print(info)
//prints out ["UIImagePickerControllerEditedImage": <UIImage: 0x610000294320> size {746, 498} orientation 0 scale 1.000000, "UIImagePickerControllerMediaType": public.image, "UIImagePickerControllerCropRect": NSRect: {{0, 0}, {2661, 1779}}, "UIImagePickerControllerReferenceURL": assets-library://asset/asset.JPG?id=ED7AC36B-A150-4C38-BB8C-B6D696F4F2ED&ext=JPG, "UIImagePickerControllerOriginalImage": <UIImage: 0x610000299320> size {2668, 1780} orientation 0 scale 1.000000]
if let image = info[UIImagePickerControllerEditedImage] as? UIImage {
completion(image)
viewController.dismiss(animated: true, completion: nil)
} else if let image = info[UIImagePickerControllerOriginalImage] as? UIImage {
viewController.dismiss(animated: true, completion: nil)
completion(image)
} else {
print("something is wrong line \(#line)")
}
}
}//end of extension
class ProfileViewController: UITableViewController {
var imagePickerHelper: ImagePickerHelper!
override func viewDidLoad() {
super.viewDidLoad()
}
#IBAction func takePhoto(_ sender: Any) {
//create instance of ImagePickerHelper and take photo, or get it from photoLibrary
imagePickerHelper = ImagePickerHelper( viewController: self, cameraFlashMode: .auto,photoLibraryIsVisible: true, cameraDevice: .front,
completion: { [weak self] (newImage) in
})
}
}//end of class

UILabel data to UIAlert issue in xcode 8, error

I made an alert and I tried to follow a tutorial and put it into my code. I put the code in a few different places but the errors just kept getting worse. I finally just put it at the bottom, because thats where I ended up getting the fewest errors. I'm new to xcode so this very basic thing is very hard for me. Furthermore, I get errors all over the place when I put this in, and I have no idea how to fix this. Moreover, what I am trying to do is take the data that is being saved in my UILabel which is a name, and I want that to be shown up in the clickable part of the alert that "dismisses" the alert, but I have no idea how to do that or even get started when I can't add a basic alert into my code. Any help would be great source code even better. Sorry for all the questions. Thanks again in advance.
import UIKit
import MultipeerConnectivity
class ViewController: UIViewController, MCBrowserViewControllerDelegate {
#IBOutlet weak var input: UITextField!
#IBOutlet weak var output: UILabel!
#IBAction func action(_ sender: Any) {
output.text = input.text
UserDefaults.standard.set(input.text, forKey: "MyName")
input.text = ""
}
var currentPlayer:String!
var appDelegate:AppDelegate!
override func viewDidLoad() {
super.viewDidLoad()
appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.MPCHandler.setupPeerWithDisplayName(UIDevice.current.name)
appDelegate.MPCHandler.setupSession()
appDelegate.MPCHandler.advertiseSelf(true)
NotificationCenter.default.addObserver(self, selector: Selector(("peerChangedStateWithNotification:")), name: NSNotification.Name(rawValue: "MPC_DidChangeStateNotification"), object: nil)
NotificationCenter.default.addObserver(self, selector: Selector(("handleReceivedDataWithNotification:")), name: NSNotification.Name(rawValue: "MPC_DidReceiveDataNotification"), object: nil)
}
#IBAction func connect(_ sender: Any) {
if appDelegate.MPCHandler.session != nil{
appDelegate.MPCHandler.setupBrowser()
appDelegate.MPCHandler.browser.delegate = self
self.present(appDelegate.MPCHandler.browser, animated: true, completion: nil)
}
}
func peerChangedStateWithNotification(notification:NSNotification){
let userInfo = NSDictionary(dictionary: notification.userInfo!)
let state = userInfo.object(forKey: "state") as! Int
if state != MCSessionState.connecting.rawValue{
self.navigationItem.title = "Connected"
}
}
func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController) {
appDelegate.MPCHandler.browser.dismiss(animated: true, completion: nil)
}
func browserViewControllerWasCancelled(_ browserViewController: MCBrowserViewController) {
appDelegate.MPCHandler.browser.dismiss(animated: true, completion: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewDidAppear(_ animated: Bool) {
if let x = UserDefaults.standard.object(forKey:"myName") as?
String
{
output.text = x
}
}
}
func viewDidAppear(_animated: Bool) {
createAlert(title: "HI", message: "ARE YOU READY")
}
func createAlert (title: String, message:String)
{
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "HI", style: UIAlertActionStyle.default, handler: { (action) in alert.dismiss(animated: true, completion: nil);))
self.present(alert,animated: true, completion:nil)
}
}
The error you are most probably getting is Invalid redeclaration of 'viewDidAppear' means you are trying to add viewDidAppear method twice in your ViewController. So remove the below one method form your code and call createAlert inside the already exist viewDidAppear one.
Your second mistake is you forgot to add } for UIAlertActionHandler and there is no need to call dismiss on alert action it will automatically dismiss the alert.
You need to also change your selector syntax to Swift3 one and also you forgot to add handleReceivedDataWithNotification with your code.
Now with Swift use Swift native dictionary type instead of NSDictionary, so change your controller with below one to get your desired output.
class ViewController: UIViewController, MCBrowserViewControllerDelegate {
#IBOutlet weak var input: UITextField!
#IBOutlet weak var output: UILabel!
var currentPlayer:String!
var appDelegate:AppDelegate!
override func viewDidLoad() {
super.viewDidLoad()
appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.MPCHandler.setupPeerWithDisplayName(UIDevice.current.name)
appDelegate.MPCHandler.setupSession()
appDelegate.MPCHandler.advertiseSelf(true)
NotificationCenter.default.addObserver(self, selector: #selector(peerChangedStateWithNotification(_:)), name: NSNotification.Name(rawValue: "MPC_DidChangeStateNotification"), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleReceivedDataWithNotification(_:)), name: NSNotification.Name(rawValue: "MPC_DidReceiveDataNotification"), object: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
#IBAction func connect(_ sender: Any) {
if appDelegate.MPCHandler.session != nil{
appDelegate.MPCHandler.setupBrowser()
appDelegate.MPCHandler.browser.delegate = self
self.present(appDelegate.MPCHandler.browser, animated: true, completion: nil)
}
}
#IBAction func action(_ sender: Any) {
output.text = input.text
UserDefaults.standard.set(input.text, forKey: "MyName")
input.text = ""
}
func peerChangedStateWithNotification(_ notification: Notification) {
let userInfo = notification.userInfo!
let state = userInfo["state"] as! Int
if state != MCSessionState.connecting.rawValue{
self.navigationItem.title = "Connected"
}
}
func handleReceivedDataWithNotification(_ notification: Notification) {
let userInfo = notification.userInfo!
print(userInfo)
}
func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController) {
appDelegate.MPCHandler.browser.dismiss(animated: true, completion: nil)
}
func browserViewControllerWasCancelled(_ browserViewController: MCBrowserViewController) {
appDelegate.MPCHandler.browser.dismiss(animated: true, completion: nil)
}
override func viewDidAppear(_ animated: Bool) {
if let x = UserDefaults.standard.string(forKey: "myName") {
output.text = x
}
else {
output.text = "Default Name" //Set here default Name
}
self.createAlert(title: "HI", message: "ARE YOU READY")
}
func createAlert (title: String, message:String)
{
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: output.text, style: UIAlertActionStyle.default, handler: { (action) in
}))
self.present(alert,animated: true, completion:nil)
}
}
import UIKit
import MultipeerConnectivity
class ViewController: UIViewController, MCBrowserViewControllerDelegate {
#IBOutlet weak var input: UITextField!
#IBOutlet weak var output: UILabel!
#IBAction func dick(_ sender: Any) {
output.text = input.text
UserDefaults.standard.set(input.text, forKey: "MyName")
input.text = ""
}
var currentPlayer:String!
var appDelegate:AppDelegate!
override func viewDidLoad() {
super.viewDidLoad()
appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.MPCHandler.setupPeerWithDisplayName(UIDevice.current.name)
appDelegate.MPCHandler.setupSession()
appDelegate.MPCHandler.advertiseSelf(true)
NotificationCenter.default.addObserver(self, selector: #selector(ViewController.peerChangedStateWithNotification(_:)), name: NSNotification.Name(rawValue: "MPC_DidChangeStateNotification"), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(ViewController.handleReceivedDataWithNotification(_:)), name: NSNotification.Name(rawValue: "MPC_DidReceiveDataNotification"), object: nil)
}
#IBAction func connect(_ sender: Any) {
if appDelegate.MPCHandler.session != nil{
appDelegate.MPCHandler.setupBrowser()
appDelegate.MPCHandler.browser.delegate = self
self.present(appDelegate.MPCHandler.browser, animated: true, completion: nil)
}
}
#IBAction func action(_ sender: Any) {
output.text = input.text
UserDefaults.standard.set(input.text, forKey: "MyName")
input.text = ""
}
func peerChangedStateWithNotification(_ notification: Notification) {
let userInfo = notification.userInfo!
let state = userInfo["state"] as! Int
if state != MCSessionState.connecting.rawValue{
self.navigationItem.title = "Connected"
}
}
func handleReceivedDataWithNotification(_ notification: Notification) {
let userInfo = notification.userInfo!
print(userInfo)
}
func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController) {
appDelegate.MPCHandler.browser.dismiss(animated: true, completion: nil)
}
func browserViewControllerWasCancelled(_ browserViewController: MCBrowserViewController) {
appDelegate.MPCHandler.browser.dismiss(animated: true, completion: nil)
}
*func viewdidloadOverride; func viewDidAppear*(_ animated: Bool) {
if let x = UserDefaults.standard.string(forKey: "myName") {
output.text = x
}
else {
output.text = "x" //Set here default Name
}
self.createAlert(title: "HI", message: "ARE YOU READY")
}
func createAlert (title: String, message:String)
{
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: output.text, style: UIAlertActionStyle.default, handler: { (action) in
}))
self.present(alert,animated: true, completion:nil)
}
}

Using an alert to choose between image gallery or camera in UIImagePickerController

I have an UIImagePickerController that works, but I wanted to let the user decide whether he shoots the image or picks it from library. So this is my code trying to do it with alert:
#IBAction func cameraButton(_ sender: UIButton) {
picker.allowsEditing = true
let alert = UIAlertController(title: "Choose one of the following:", message: "", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "Gallery", style: .default, handler: { action in
self.picker.sourceType = .photoLibrary
}))
alert.addAction(UIAlertAction(title: "Camera", style: .default, handler: { action in
self.picker.sourceType = .camera
}))
self.present(alert, animated: true, completion: nil)
present(picker, animated: true, completion: nil)
}
However, once I click on one of the actions in the alert, nothing happens, it just gets out of the alert but not presenting my picker
Any help is appreciated
I solved it by presenting inside the action like this:
#IBAction func cameraButton(_ sender: UIButton) {
picker.allowsEditing = true
let alert = UIAlertController(title: "Choose one of the following:", message: "", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "Gallery", style: .default, handler: { action in
self.picker.sourceType = .photoLibrary
self.present(self.picker, animated: true, completion: nil)
}))
alert.addAction(UIAlertAction(title: "Camera", style: .default, handler: { action in
self.picker.sourceType = .camera
self.present(self.picker, animated: true, completion: nil)
}))
self.present(alert, animated: true, completion: nil)
}

Perform a segue to a new viewController when clicking the "use photo" button after taking picture with camera iOS 10 (swift 3)

I want the user to be taken to a new viewController after clicking "use photo" after taking a picture. However, the segue is never performed. I have attempted this segue by connecting two viewControllers via a manual segue. I have a print statement in my imagePickerController function which is where my segue code is. This print statement prints when I click "use photo", so why is my segue be ignored? I tried this exact same segue code within a "#IBAction func someButton (_sender: UIButton)" and it worked fine? Any help would be appreciated.
Here is my code:
import UIKit
class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
#IBOutlet weak var imageTake: UIImageView!
var imagePicker: UIImagePickerController!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
#IBAction func takePhoto(_ sender: UIButton) {
imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .camera
present(imagePicker, animated: true, completion: nil)
}
#IBAction func photoLib(_ sender: UIButton) {
imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .photoLibrary
present(imagePicker, animated: true, completion: nil)
}
#IBAction func save(_ sender: AnyObject) {
UIImageWriteToSavedPhotosAlbum(imageTake.image!, self, #selector(image(_:didFinishSavingWithError:contextInfo:)), nil)
}
func image(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) {
if let error = error {
// we got back an error!
let ac = UIAlertController(title: "Save error", message: error.localizedDescription, preferredStyle: .alert)
ac.addAction(UIAlertAction(title: "OK", style: .default))
present(ac, animated: true)
} else {
let ac = UIAlertController(title: "Saved!", message: "Your altered image has been saved to your photos.", preferredStyle: .alert)
ac.addAction(UIAlertAction(title: "OK", style: .default))
present(ac, animated: true)
}
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
imagePicker.dismiss(animated: true, completion: nil)
imageTake.image = info[UIImagePickerControllerOriginalImage] as? UIImage
print("made it")
performSegue(withIdentifier: "new", sender: self)
}
}
Here's a suggestion. You have this:
imagePicker.dismiss(animated: true, completion: nil)
// ...
performSegue(withIdentifier: "new", sender: self)
Change it to this:
imagePicker.dismiss(animated: true, completion: {
performSegue(withIdentifier: "new", sender: self)
})
That way, we don't try to perform the segue until the image picker is in fact completely dismissed.
If that doesn't work, then I would have to conclude that there is no such segue as "new" coming from this view controller. But you have not shown your storyboard so I can't be certain.

Xcode 8 - swift 3: Creating an image format with an unknown type is an error

I get an error when selecting an image with UIImagePicker:
[Generic] Creating an image format with an unknown type is an error
I'm using Xcode 8.1 and Swift 3.
I've already searched all around the web but nothing seems to solve my problem, please help!
Here it's my code:
class TabBarController: UITabBarController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
var isSelected: Bool = false
var imgPicker: UIImagePickerController = UIImagePickerController()
override func viewDidLoad() {
super.viewDidLoad()
//imgPicker = UIImagePickerController()
imgPicker.delegate = self
imgPicker.allowsEditing = false
imgPicker.sourceType = .photoLibrary
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
imgPicker.dismiss(animated: true, completion: nil)
if let image = info[UIImagePickerControllerOriginalImage] as? UIImage {
self.performSegue(withIdentifier: "toPostPicture", sender: image)
}
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
dismiss(animated: true, completion: nil)
}
func askImagePickerSource(sender: UIViewController) {
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) {
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let cameraAction = UIAlertAction(title: "Camera", style: .default, handler: { (action: UIAlertAction) in
self.imgPicker.sourceType = .camera
self.imgPicker.mediaTypes = UIImagePickerController.availableMediaTypes(for: .camera)!
sender.present(self.imgPicker, animated: true, completion: nil)
})
let photoLibraryAction = UIAlertAction(title: "Photo Library", style: .default, handler: { (action: UIAlertAction) in
self.imgPicker.mediaTypes = UIImagePickerController.availableMediaTypes(for: .photoLibrary)!
sender.present(self.imgPicker, animated: true, completion: nil)
})
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) { (UIAlertAction) in
sender.dismiss(animated: true, completion: nil)
}
alert.addAction(cameraAction)
alert.addAction(photoLibraryAction)
alert.addAction(cancelAction)
sender.present(alert, animated: true, completion: nil)
} else {
self.imgPicker.mediaTypes = UIImagePickerController.availableMediaTypes(for: .photoLibrary)!
sender.present(self.imgPicker, animated: true, completion: nil)
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "toPostPicture" {
if let postPictureVC = segue.destination as? PostPictureVC {
if let image = sender as? UIImage {
postPictureVC.image = image
}
}
}
}
}
I faced the same issue by not adding delegate as 'self' for the UIImagePickerController. After adding it I was able to get the selected image from gallery. But even after adding delegate as self and able to access the image (Display on an ImageView), I was still getting the same error. After a further research on SO I got to know that this is just a bug and doesn't affect the app in any way.
See also "Creating an image format with an unknown type is an error Objective-C Xcode 8"
Can you post the .debugDescription of the info parameter in your picker delegate?
func imagePickerController(_ picker: UIImagePickerController,
didFinishPickingMediaWithInfo info: [String : Any]) {
print(info.debugDescription)
...
}