我使用一个信号来发送推送通知。但是,如果通知内容正文仅包含数字,则不会显示。
手机会震动,甚至连徽章号码都会按预期增加,但什么也不会显示。在iOS 9和10上都会发生这种情况。
如果我记录内容,我可以看到数字,所以它完美地通过了,但它不显示。
你知道是什么原因造成的吗?
发布于 2017-02-09 14:49:31
您将需要处理来自应用程序委托文件的通知并显示消息。您应该在AppDelegate的didReceiveRemoteNotification方法的user info参数中获取完整的通知正文。您将需要从中检索信息并显示警报。
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
println("Recived: \(userInfo)")
//Parsing userinfo:
var temp : NSDictionary = userInfo
if let info = userInfo["aps"] as? Dictionary<String, AnyObject>
{
var alertMsg = info["alert"] as! String
var alert: UIAlertView!
alert = UIAlertView(title: "", message: alertMsg, delegate: nil, cancelButtonTitle: "OK")
alert.show()
}
} https://stackoverflow.com/questions/42096843
复制相似问题