4

Here is the simplified version of my code:

import UIKit
import CoreLocation

class ViewController: UIViewController {

  override func viewDidAppear() {
    super.viewDidAppear()

    let locationManager = CLLocationManager()
    locationManager.delegate = self
    locationManager.requestWhenInUseAuthorization()
  }
}

extension ViewController: CLLocationManagerDelegate {}

When launched, I expect this code to display the location permission dialog. I've added the NSLocationWhenInUseUsageDescription key into Info.plist file already.

This code works correctly when the application runs in full screen. However, when launched in split screen the dialog never appears.

I couldn't find anybody else battling this problem except for this forum: https://developer.apple.com/forums/thread/686064 which didn't come to any conclusion.

I thought it may be the OS limitation, but Google seem to have figured it out: enter image description here

Any ideas?

Allan Spreys
  • 5,287
  • 5
  • 39
  • 44
  • Is the app able to present `UIAlert` or other dialogs at the same stage? – Abhinav Mathur Sep 02 '22 at 04:19
  • Hi @AbhinavMathur, thanks for the question! It didn't in `viewDidLoad`, but it does in `viewDidAppear`. I've tried moving the location request to `viewDidAppear`, which is now reflected in the updated question, but it's still the same issue. – Allan Spreys Sep 04 '22 at 21:13
  • Oh, I see. You say "split view" but you actually mean iPad Multitasking. Yeah, interesting. I haven't tried this. But I would expect it to work. Keep in mind that you can't make the dialog appear at all if the user has already weighed in. Have you a genuine [mcve]? Your current code is sort of fake. How would you launch _initially_ into split view multitasking mode? – matt Sep 04 '22 at 21:38
  • Hi @matt, that's a minimal reproducible example actually. You can start a safari in split view, then launch the app with that one view controller. – Allan Spreys Sep 04 '22 at 21:59
  • Yes, I see it, exactly as described at https://developer.apple.com/forums/thread/686064 – matt Sep 04 '22 at 23:48
  • I think you should file a bug with Apple and see if anything develops. – matt Sep 05 '22 at 01:24
  • I've submitted a bug report – Allan Spreys Sep 05 '22 at 23:03

1 Answers1

0

I had a confirmation from Apple that this is an operating system level bug. There is no known workaround. It has been fixed in iOS 16.0

Allan Spreys
  • 5,287
  • 5
  • 39
  • 44