1 Reply
      Latest reply on Oct 21, 2019 1:37 AM by samspam
      Ricardo1980 Level 1 Level 1 (0 points)

        Hello,

         

        Sometimes, this piece of code opens iPhone Settings (instead of app Settings)

         

        let url = URL(string: UIApplication.openSettingsURLString)
        UIApplication.shared.open(url!, options: [:], completionHandler: nil)

         

        But other times, it opens app settings, as the documentation says.

        (I am using iPhone X and iOS 12)

         

        I think the reason is that when the app does not appear in the settings list (because it is the first time that app is exectured), then openURL does not know how to open app settings (because it does not exist) and opens iphone settings. To test that, create an app with those 2 lines of code. And remember to reset the simulator entirely to test the wrong case.

         

        Do you have or see the same problem?

         

        Thanks a lot.