0
我对编程和开发应用程序时颇为陌生,该应用程序会在我的商店打开时通知用户。我正在使用Firebase来存储数据,我正在寻找使用本地通知而不是推送。使用Firebase的本地通知
我有我的应用程序委托设置根据一些在线来源发送通知,但我不知道如何调用它的功能。我在Xcode中使用了swift 4。
import Firebase
var refNotificationValue = DatabaseReference!
@IBAction func openButtonClicked(_ sender: UIButton) {
// Alert Controller confirming actions
self.shouldSendNotification()
}
// DidLoad()
refNotificationValue = database.database().reference().child("Notifications").child("enabled") // set to yes
// EndLoad()
func shouldSendNotification() {
refNotificationValue?.observeSingleEvent(of: .value, with: { (snapshot) in
let dict = snapshot.value as! [String: Any]
let status = dict["enabled"] as! String
if status == "yes" {
setToOpen()
sendNotification()
} else {
setToOpen()
}
})
}
func sendNotification() {
????????
}
非常感谢!
谢谢!我已经制定了你在第二种方式列出的背景获取 –
很棒!我很乐意帮忙=) –
达斯汀,有没有办法在这里私下给你发消息?我真的可以使用一些帮助,并在这个问题上停留了一个月。谢谢你 –