我是所有iOS推送通知域的新手。我已经使用下面的代码尝试了一个基本的推送通知,它完美地工作。我正在使用“使用JdSoft.Apple.Apns.Notifications;”来完成这一点。下面的代码:iOS推送通知自定义格式
Notification alertNotification = new Notification(testDeviceToken);
alertNotification.Payload.Alert.Body = "Hello World";
alertNotification.Payload.Sound = "default";
alertNotification.Payload.Badge = 1;
这给出了以下的结构输出到iPhone:
{
aps = {
alert = "Hello World";
badge = 1;
sound = default;
};
}
我现在拿到添加自定义标签的要求如下:
{
"aps": {
"alert": "Hello World",
"sound": "default",
"Person": {
"Address": "this is a test address",
"Name": "First Name",
"Number": "023232323233"
}
}
}
我发现很难在“aps”中获得“Person”。我也知道您可以使用以下代码添加自定义属性:
alertNotification.Payload.AddCustom(“Person”,Newtonsoft.Json.JsonConvert.SerializeObject(stat));
但上面的代码并没有添加“aps”标签。请告诉我如何实现?
自定义实体不应该在APS元素。 [苹果示例有效载荷](http://developer.apple.com/library/iOS/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW15) – rckoenes 2013-04-05 13:04:13