invalid mode 'kCFRunLoopCommonModes'

invalid mode 'kCFRunLoopCommonModes' provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug


I get this warning when I tap either of the switches shown below. I've tried capturing the switch state in a var and using that to trigger the do/catch statement but no joy. I've even tried pulling the do/catch into separate functions and I still get the warning. Has anybody else run into this and how did you fix it?


@IBAction func greetingFormat_Tapped(_ sender: UISwitch)
    {
        let theQuery = theTable_Settings.filter(settingID == 1)
       
        if sender.isOn
        {
            do {
                if try Database.shared.databaseConnection!.run(theQuery.update(greeting_Format <- "true")) > 0
                {
                    greetingFormatLabel_Outlet.text = NSLocalizedString("HelloMrSmith_String", comment: "")
                } else {
                    print("greeting format true not found")
                }
            } catch {
                print("greeting format true update failed! Error: \(error)")
            }
        } else {
            do {
                if try Database.shared.databaseConnection!.run(theQuery.update(greeting_Format <- "false")) > 0
                {
                    greetingFormatLabel_Outlet.text = NSLocalizedString("HiJoe_String", comment: "")
                } else {
                    print("greeting format false not found")
                }
            } catch {
                print("greeting format false update failed! Error: \(error)")
            }
        }
    }


@IBAction func nonrefundableSwitch_Tapped(_ sender: UISwitch)
    {
        let theQuery = theTable_Settings.filter(settingID == 1)
        var itsOn: String = ""
       
        if sender.isOn
        {
            itsOn = "true"
        } else {
            itsOn = "false"
        }
       
        if itsOn == "true"
        {
            do {
                if try Database.shared.databaseConnection!.run(theQuery.update(nonRefundable_Bool <- "true")) > 0
                {
                    depositDueLabel_Outlet.text = NSLocalizedString("nonRefunddepositisdue_String", comment: "")
                } else {
                    print("nonRefundable true not found")
                }
            } catch {
                print("nonRefundable true update failed! Error: \(error)")
            }
        } else {
            do {
                if try Database.shared.databaseConnection!.run(theQuery.update(nonRefundable_Bool <- "false")) > 0
                {
                    depositDueLabel_Outlet.text = NSLocalizedString("depositisdue_String", comment: "")
                } else {
                    print("nonRefundable false not found")
                }
            } catch {
                print("nonRefundable false update failed! Error: \(error)")
            }
        }
    }
Post not yet marked as solved Up vote post of quailcreek Down vote post of quailcreek
22k views
  • It's August 13, 2023. Still happening.

Add a Comment

Replies

3 Nov, 2023. This still happening.

This is a perfect example of Apple's lack of concern about cleaning up their code and why you can't rely on them to fix reported bugs.

Their focus is always on the next best thing (which is often catching up with the competition).

Find a work around and keep on developing your code.

I've been working around issues in every release since iOS 3.

I used to update immediately to the latest iOS version in the hope that they had fixed some of the bugs I reported.

Instead I found myself an unwilling beta tester for their latest release.

Now, I give everyone else a few weeks to catch the latest bugs before I stick my toe in the water.

This problem isn't limited to Apple - I see the same thing everywhere - I just happened across this error again tonight and it made me sad to think there's nothing any of us can do to make them care about cleaning up their code.