2016-01-27 90 views
0

我試圖保存UISwitch結果並使用它們爲Parse.com推送通知填充「頻道」。我遵循了「分析指南」,但每次嘗試時我都會收到一個SIGABRT,然後單擊保存按鈕以保存交換機的值。任何幫助,非常感謝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

要確定哪些語句創建錯誤,設置異常斷點:在Xcode中的斷點導航器,單擊加號下降然後選擇「添加異常斷點...」,然後點擊返回。運行你的應用程序,它會停止在有問題的指令。 –

+0

爲什麼不更新所有頻道,然後在最後保存一次... – Wain

回答

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

和平, 一見鍾情。但是造化