0

There are 3 UIViewControllers under NavigationController and tabBarController.

Push the viewControllers like this: A->B->C

In viewController C, add the following codes to let user to select image from photo library.

func btnClicked() {
    let imagePickerController = UIImagePickerController()
    imagePickerController.sourceType = .photoLibrary
    imagePickerController.delegate = self
    self.present(imagePickerController, animated: true, completion: nil)
}


func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
    if let image = info[UIImagePickerControllerOriginalImage] as? UIImage{
       topIamge.image = image
    }

    picker.dismiss(animated: false, completion: nil)

}

Problem is that after the user select an image or cancel the selection, then press the left bar button going back to B, an error Unbalanced calls to begin/end appearance transitions for shows up, if continue going back to A, the error is printed out again.

Did I make anything wrong?

P.S. There is no error if I press the back button without presenting UIImagePickerController.

Thx.

jdleung
  • 1,088
  • 2
  • 10
  • 26

1 Answers1

0

I'm sure it doesn't related UIImagePickerController Check these solution : https://stackoverflow.com/a/12230777/6131436

https://stackoverflow.com/a/20925686/6131436

  • Sorry, they don't solve my problem. If I just press back button without presenting UIImagePickerController, the error will not show up. – jdleung Jul 30 '17 at 23:56