Home>
When transition from screen A to screen B
whose view is not in the window hierarchy
Will be displayed after the transition.
I made the corrections described here here The warning will not disappear.
What is the cause?
Thanks for your reply.
*** is the project name.
*** [2511: 482344] Warning: Attempt to present<***. BViewController: 0x104a2a010>on<***. ViewController: 0x104c09870>whose view is not in the window hierarchy!</code ></pre>
<strong>Applicable source code</strong>
<p>Screen A</p>
<pre><code data-language = "Swift">import UIKit
class ViewController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var t1: UITextField!
override func viewDidLoad () {
super.viewDidLoad ()
// Do any additional setup after loading the view.
}
override func viewDidAppear (_ animated: Bool) {
super.viewDidAppear (animated)
t1.delegate = self
t1.keyboardType = .URL
}
// --- Keyboard close process ---
// To screen B
@IBAction func goNext (_ sender: UIButton) {
performSegue (withIdentifier: "toB", sender: nil)
}
// Pass the entered text to the next screen
override func prepare (for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "toB" {
let bView = segue.destination as! BViewController
bView.t1 = t1.text!
}
}
}
Screen B
import UIKit
class BViewController: UIViewController {
var t1 = ""
override func viewDidLoad () {
super.viewDidLoad ()
// Do any additional setup after loading the view.
}
// --- Do the necessary processing below ---
}
Supplemental information (FW/tool version etc.)
Version
Xcode 11.1, Swift 5.0.1
-
Answer # 1
Related articles
- [javascript] in an array in an array in an array how to loop an array whose hierarchy is unknown
- swift - i want to swipe back the pageviewcontroller whose transitionstyle is scroll in the hierarchy of uinavigationcontroller
- swift - screen transition is not possible whose view is not in the window hierarchy!
- ios - [swift] firebase there is a bug whose meaning is not well understood
Trends
I wonder if I made an error during the second transition after the second transition. What happens if I check ↓?
https://StackOverflow.com/questions/224322#reply-328575