0
我做了一個RSS應用程序,它的工作原理非常完美,我還添加了推送通知支持,目前爲止所有內容都很好,將標題,提醒和網址作爲額外字段傳遞。打開通知提醒後加載Web視圖?
當我通知到來時,我告訴我的警覺,和你有2個選項「感謝名單|打開」
所有我想現在要做的就是,當你從這個警報點擊打開,我需要重定向我的用戶到具有UIwebview的視圖並加載我與通知一起傳遞的url。
任何人都可以幫助我嗎?
這裏是我的代碼:
// here is my app delegate
-(void)onReceivePushNotification:(NSDictionary *) pushDict andPayload:(NSDictionary *)payload {
[payload valueForKey:@"title"];
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"New Alert !" message:[pushDict valueForKey:@"alert"] delegate:self cancelButtonTitle:@"Thanks !" otherButtonTitles: @"Open",nil];
NSLog(@"message was : %@", [pushDict valueForKey:@"alert"]);
NSLog(@"url was : %@", [payload valueForKey:@"url"]);
[message show];
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:@"Open"]) {
[[Pushbots getInstance] OpenedNotification];
// Decrease Badge count by 1
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:[UIApplication sharedApplication].applicationIconBadgeNumber -1];
// Decrease badge count on the server
[[Pushbots getInstance] decreaseBadgeCountBy:@"1"];
[[NSNotificationCenter defaultCenter] postNotificationName:@"updateRoot" object:nil];
} else {
// set Badge to 0
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
// reset badge on the server
[[Pushbots getInstance] resetBadgeCount];
}
}
我的詳細觀點被稱爲: 「APPDetailViewController」,與所謂的 「web視圖」
請幫我一個Web視圖? 在此先感謝。
Web視圖不在選項卡中,它通過navigationViewController連接到一個可視化視圖,該視圖嵌入tabviewController以及其他3個視圖,任何解決方案! – 2014-09-04 23:05:59
我很困惑。你有一個視圖控制器與表視圖,你點擊一個單元格,這將轉到一個新的視圖控制器與Web視圖? – 2014-09-04 23:19:43
是的,那個表視圖是使用導航視圖控制器推push segue, 這裏是我的應用程序的解剖,它使用UITabBarViewController來保存4個標籤 1st tab>「news」UINavagationViewController> UITableView>單擊一個單元格> UIViewController> load WebView 第2個選項卡>靜態YouTube webview 第3個選項卡>聯繫我們 第4個選項卡>關於應用程序 – 2014-09-04 23:52:29