我有遠程通知字典,但是如何獲取AlertBody?Monotouch:獲取NSDictionary值
NSDictionary remoteNotification = options
[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
from remoteNotification?
我有遠程通知字典,但是如何獲取AlertBody?Monotouch:獲取NSDictionary值
NSDictionary remoteNotification = options
[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
from remoteNotification?
這個工作對我來說:
發送推送通知:
oPushService.QueueNotification(NotificationFactory.Apple()
.ForDeviceToken("[email protected]#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.... }
何它有幫助!
阿曼多
這取決於您發送給應用程序的內容。基本上,這是您發送的JSON請求轉換爲NSDictionary表單。
var k = new Object[] {"key"};
var v = new Object[] {"value"};
NSDictionary a = NSDictionary.FromObjectsAndKeys(v,k);
NSObject value = a[NSObject.FromObject("key")];
U可以試試這個,它的工作對我來說....