3 Replies
      Latest reply on Sep 29, 2019 2:28 PM by ClassicalDude
      OPRoss Level 1 Level 1 (0 points)

        In iOS Settings -> (app name) I have multiple settings defined (from Settings.bundle -> Root.plist).  The slider setting I have defined (PSSliderSpecifier) is now producing incorrect values in iOS 13 Beta 2 when in prior iOS versions it worked correctly.  When I access the current setting/slider value from the app (CGFloat qrCodeSize = [[NSUserDefaults standardUserDefaults] floatForKey:@"qrCodeSize"];) I get a value that is less than 0 (ex: 0.00012345) instead of a value between my defined bounds of min (350) and max (400) defined values.  Again, this only happens in iOS 13 and not iOS 12.






















        Submitted in Feedback: FB6205390

        • Re: iOS 13 Beta 2 App setting of type PSSliderSpecifier returns incorrect value when accessing from app
          OPRoss Level 1 Level 1 (0 points)

          Still doesn't work in BETA 8.  After multiple developer feedback messages to Apple there is absolutely no reply from them.  Like feedback goes into a black hole.  Really: "Apple"???

          • Re: iOS 13 Beta 2 to Beta 8 App setting of type PSSliderSpecifier returns incorrect value when accessing from app
            ClassicalDude Level 1 Level 1 (10 points)

            I can confirm this behavior, and I think I was able to pinpoint what exactly happens and a possible workaround.


            1) Like the op said, the default value is read correctly. However, it is never reflected by the slider's UI.

            2) The slider's UI is hardcoded to real numbers between 0.0 and 1.0. It does not calculate anything, and it reflects your default as you specified it. If your default is bigger than 1, the slider will be at maximum from the first run of the app. If your minimum was 0.5, your maximum was 2.0 and your default was 0.6, the slider will appear at 60%.

            3) Any user interaction with the slider will replace the default with the slider's position between 0.0 and 1.0.


            The workaround will therefore be:

            1) Translate the default values of your slider to a scale between 0.0 and 1.0. For instance, I wanted the values:

            min: 0.001 min

            default: 0.01

            max: 0.15


            In iOS 12 I chose 1 min, 10 default and 150 max, and multiplied them by 0.001 when reading them.


            In iPadOS 13.1:

            min: 0.0 (nothing we can do about that)

            max: 1.0 (nothing we can do about that)

            And this is not so great, because we are neither 0 nor 1 based. Therefore the formula for getting the variable would be:

            let yourVariable = (UserDefaults.standard.double(forKey: "yourKey") + yourMinValue/(yourMaxValue-yourMinValue)) * (yourMaxValue-yourMinValue)


            And you calculate your default like this:

            defaultForPList = (yourDesiredDefaultValue-yourMinValue) / (yourMaxValue-yourMinValue)


            Note that in the plist you should define the values as real, not as integer.


            So in my case, for a min of 0.001, max of 0.15 and default of 0.01:

            let myVar = (UserDefaults.standard.double(forKey: "myKey") + 0.001/(0.15-0.001)) * (0.15-0.001)

            myDefault = (0.01-0.001)/(0.15-0.001) = 0.06040268456


            Thankfully, this works for iOS 12 as well.


            I filed with the feedback assistant, and made reference to the original report. The number of my feed back is FB7335083.