0
我正在使用Parse將推送通知發送到我的應用程序。我想要的是,當用戶從鎖定屏幕上輕掃通知或從主屏幕輕擊通知時,它會打開應用程序,並在UIAlert視圖中顯示推送通知的文本。顯示在UIAlert視圖中推送通知文本
我想它會插入應用程序委託的didfinishlaunchingwithoptions方法,但我真的沒有得到關於如何提取警報文本的線索。
任何意見將不勝感激。
所以下面是我的代碼來顯示警報 - 這是工作,但它顯示完整的JSON消息 - 當我嘗試使用objectForKey:@「警報語句試圖提取」警報「部分推送通知,沒有顯示任何警報的消息部分。
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
[PFPush handlePush:userInfo];
pushText = [userInfo objectForKey:@"alert"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"News", "")
message:pushText
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles: nil];
[alert show];
}