@JimmyCricket Is this for something like document revision conflict? Ideally there'd be a mapping somewhere in your app between iCloud documents and scenes (perhaps with UISceneSession
's persistentIdentifier
). Then you would know exactly what scene any sort of alert should be presented on.
This is the best type of solution in this case. Tie information together and plumb it where you need it so you can make the right decision. Since iOS 13, we've had to help teams internally do the same, often by adding a UIWindowScene
parameter in their API so they have context as to where the interaction took place.
That being said, sometimes doing that level of refactor isn't always possible. The solution above will continue to work. It is just deprecated. Just note that the solution above is guaranteed to be wrong some percentage of the time as the application-level key window is not totally within your control.