点击本地通知时打开Web视图

时间:2014-10-17 09:23:53

标签: ios objective-c

当用户点按本地通知时,我想在应用内的网络视图中打开网址。我是使用网络浏览器做的,但这不是我想要的。怎么做,帮助将有责任。感谢..

- (void)application:(UIApplication *)application didReceiveLocalNotification: (UILocalNotification *)notification
{
    if (application.applicationState == UIApplicationStateInactive)
    {
        NSString *NotificationValue = [notification.userInfo objectForKey:@"myId"];
        NSLog(@"Notification Id is:%@",NotificationValue);

        NSString *fullURL1 = @"http://www.hiberryfarm.com/mobile/freshtoday.html?id=3";
        NSURL *url1 = [NSURL URLWithString:fullURL1];

        if ([[UIApplication sharedApplication]canOpenURL:url1]) {
             [[UIApplication sharedApplication] openURL:url1];
        }

    }

0 个答案:

没有答案