2

我有远程通知字典,但如何取出 AlertBody?

NSDictionary remoteNotification = options 
     [UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;

从远程通知?

4

3 回答 3

2
        var k = new Object[] {"key"};
        var v = new Object[] {"value"};
        NSDictionary a = NSDictionary.FromObjectsAndKeys(v,k);
        NSObject value = a[NSObject.FromObject("key")];

你可以试试这个它对我有用....

于 2012-09-04T15:50:53.687 回答
2

这对我有用:

发送推送通知:

oPushService.QueueNotification(NotificationFactory.Apple()
    .ForDeviceToken("YourDeviceTokenASDASD!@#SDF")
    .WithCustomItem("MyCustomItem","Item 3")
    .WithAlert("Alert pop message")
    .WithSound("default")
    .WithBadge(7))); 

在客户端:

void processNotification(NSDictionary options, bool fromFinishedLaunching) {                   
(options != null && options.ContainsKey(new NSString("aps"))) {    
    NSDictionary alertMsg = options; 
    NSObject codeCustomValue = alertMsg[NSObject.FromObject("MyCustomItem")];
    // .... and continue your code....  }

希望能帮助到你!

阿曼多

于 2012-09-07T21:47:55.643 回答
0

这取决于您发送给应用程序的内容。基本上,它是您发送的转换为 NSDictionary 形式的 JSON 请求。

于 2012-07-05T12:37:22.777 回答