c# - 单点触控 : getting NSDictionary value

标签 c# ios mono xamarin.ios push-notification

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

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

来自远程通知?

最佳答案

这对我有用:

发送推送通知:

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....  }

希望对你有帮助!

阿曼多

关于c# - 单点触控 : getting NSDictionary value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11336527/

相关文章:

c# - 如何将字典的内容复制到 C# 中的新字典?

c# - 如何使用 C# 在远程 Windows 计算机上创建共享文件夹?

ios - 使用 ARC 查找对象的保留位置

android - Titanium 是否会将 iPhone 应用程序转换为 Android?

html - 如何设置 UIWebView 初始位置?

c# - 何时调用 base.method() 以及 base.method() 中应包含哪些代码?

git - .gitignore 用于 Mono/MonoDevelop 项目

Monogame 和 .fx 文件?

c# - 使用Nest 2在Elasticsearch 2中索引pdf文件

c# - 如果不存在,将 key 添加到注册表