我们正在使用APNS将推送通知发送到外部设备。有效负载如下所示:
{
"data":{
"aps":{
"alert":{
"loc-args":["bharathp"],
"loc-key":"LiKudoAlertBody",
"title-loc-key":"LiKudoAlertTitle"
}
},
"fromName":"bharathp",
"source":"community",
"type":"kudos",
"message":"{....some dictionary....}",
"fromId":"1696757163"
},
"to":"some string"
}
但是在iOS上,当我收到通知时,我只会得到有效载荷的“ aps”部分。
[AnyHashable("aps"): {
alert = {
"loc-args" = (
bharathp
);
"loc-key" = LiKudoAlertBody;
"title-loc-key" = LiKudoAlertTitle;
};
}]
我正在使用
打印以上内容func application(_ application: UIApplication, didReceiveRemoteNotification data: [AnyHashable : Any]) {
// Print notification payload data
print("Push notification received: \(data)")
}
我发送的格式不正确吗?这里可能是什么问题?
答案 0 :(得分:0)
也许是因为您使用的是不推荐使用的委托方法。您可以尝试使用新的委托方法。
public class Wrapper : INotifyPropertyChanged
{
private readonly SharedModel _model;
public Wrapper(SharedModel model)
{
_model = model;
}
private string _property;
public string MyProperty
{
get { return _property; }
set { _property = value; OnPropertyChanged(); }
}
//...
public event PropertyChangedEventHandler PropertyChanged;
}