SIGABRT - 针对解析推送通知

Posted

技术标签:

【中文标题】SIGABRT - 针对解析推送通知【英文标题】:SIGABRT - Targeting Parse Push Notifications 【发布时间】:2016-01-27 02:01:15 【问题描述】:

我正在尝试保存 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()
    elselet currentInstallation = PFInstallation.currentInstallation()
        currentInstallation.removeObject("Athletics", forKey: "channels")
        currentInstallation.saveInBackground()
    


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

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

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

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

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



【问题讨论】:

要识别哪个语句产生了错误,设置一个异常断点:在Xcode的断点导航器中,单击左下角的加号并选择“添加异常断点...”,然后按回车键。运行您的应用程序,它会在有问题的指令处停止。 为什么不更新所有频道然后在最后保存一次... 【参考方案1】:

问题不在于您的代码,而在于您的 main.storyboard。当故事板元素连接到不再存在的其他元素或插座时,SIGABRT 错误会显示。

修复此错误:

    转到您的 main.storyboard 点击其中一个元素(例如 UILabel 等) 单击连接检查器(看起来像圆圈中的箭头) 查看它是否连接到不存在的东西并删除它/它们 对所有元素执行步骤 2 到 4

【讨论】:

以上是关于SIGABRT - 针对解析推送通知的主要内容,如果未能解决你的问题,请参考以下文章

如何仅针对该应用禁用来自应用的推送通知?

使用 CloudCode 发送有针对性的推送通知

托管解析是不是支持推送通知?

Android 解析推送通知和新 GCM 生成错误的设备令牌并解析推送通知不起作用

有针对性的推送通知

在 Android 中处理解析推送通知