Matt Farrell
Matt Farrell

Reputation: 1

SIGABRT - Targeting Parse Push Notifications

I am trying to save UISwitch results and using them to populate the "channels" for Parse.com push notifications. I followed the Parse Guide but I am getting a SIGABRT everytime I try and click the save button which saves the values of the switch. Any help is much appreciated

@IBAction func Save(sender: AnyObject) {

    if Athletics.on{
        let currentInstallation = PFInstallation.currentInstallation()
        currentInstallation.addUniqueObject("Athletics", forKey: "channels")
        currentInstallation.saveInBackground()
    }else{let currentInstallation = PFInstallation.currentInstallation()
        currentInstallation.removeObject("Athletics", forKey: "channels")
        currentInstallation.saveInBackground()
    }


    if Academics.on{
        let currentInstallation = PFInstallation.currentInstallation()
        currentInstallation.addUniqueObject("Academics", forKey: "channels")
        currentInstallation.saveInBackground()
    }else{let currentInstallation = PFInstallation.currentInstallation()
        currentInstallation.removeObject("Academics", forKey: "channels")
        currentInstallation.saveInBackground()
    }

    if LinkCrew.on{
        let currentInstallation = PFInstallation.currentInstallation()
        currentInstallation.addUniqueObject("LinkCrew", forKey: "channels")
        currentInstallation.saveInBackground()
    }else{let currentInstallation = PFInstallation.currentInstallation()
        currentInstallation.removeObject("LinkCrew", forKey: "channels")
        currentInstallation.saveInBackground()
    }

    if Events.on{
        let currentInstallation = PFInstallation.currentInstallation()
        currentInstallation.addUniqueObject("Events", forKey: "channels")
        currentInstallation.saveInBackground()
    }else{let currentInstallation = PFInstallation.currentInstallation()
        currentInstallation.removeObject("Events", forKey: "channels")
        currentInstallation.saveInBackground()
    }

    if Parents.on{
        let currentInstallation = PFInstallation.currentInstallation()
        currentInstallation.addUniqueObject("Parents", forKey: "channels")
        currentInstallation.saveInBackground()
    }else{let currentInstallation = PFInstallation.currentInstallation()
        currentInstallation.removeObject("Parents", forKey: "channels")
        currentInstallation.saveInBackground()
    }

    if Day1Day2.on{
        let currentInstallation = PFInstallation.currentInstallation()
        currentInstallation.addUniqueObject("Day1Day2", forKey: "channels")
        currentInstallation.saveInBackground()
    }else{let currentInstallation = PFInstallation.currentInstallation()
        currentInstallation.removeObject("Day1Day2", forKey: "channels")
        currentInstallation.saveInBackground()
    }


}

Upvotes: 0

Views: 55

Answers (1)

Cobie Fisher
Cobie Fisher

Reputation: 733

The problem is not with your code, it's with your main.storyboard. The SIGABRT error shows when a storyboard element is connected to some other element or outlet which does not exist anymore.

To fix this error:

  1. Go to your main.storyboard
  2. Click on one of your elements (e.g. UILabel, etc)
  3. Click the connections inspector (looks like arrow in a circle)
  4. See if it's connected to something that doesn't exist and delete it/them
  5. Do steps 2 to 4 with all your elements

Upvotes: 1

Related Questions