我正在尝试保存UISwitch结果并使用它们来填充"频道"用于Parse.com推送通知。我遵循了Parse Guide,但每次尝试时我都会收到一个SIGABRT,然后单击保存按钮,保存开关的值。非常感谢任何帮助
@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()
}
}
答案 0 :(得分:0)
问题不在于您的代码,而在于您的main.storyboard。 SIGABRT错误显示故事板元素何时连接到不再存在的其他元素或插座。
要解决此错误:
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
和平 一见钟情。但是造化