大发快乐8APP下载_大发快乐8APP官方 - 大发快乐8APP下载,大发快乐8APP官方是新浪网最重要的频道之一,24小时滚动报道国内、国际及社会新闻。每日编发新闻数以万计。

iOS刚进入后台接受推送、打开推送调转到相应的界面

  • 时间:
  • 浏览:0

- (void)viewDidAppear:(BOOL)animated

        [selNavi pushViewController:vc animated:YES];

    NSDictionary *dic = notification.userInfo;

    return YES;

    RootNavigationController* selNavi = [self.viewControllers objectAtIndex:MainTabBarIndex_User];

    {

}

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pushDispanchPositionDetail:) name:kString_DispantData object:nil];

{

    NSDictionary *optionsRemoteNotificationKey = [[NSUserDefaults standardUserDefaults] objectForKey:kSavePushMessage];

    /**为了验证第一次启动的原本非要截获启动信息,加啊alert**/

    /**

                                                          error:&err];

删剪解释跳转代码

        UIAlertView *art = [[UIAlertView alloc]initWithTitle:nil message:str delegate:self cancelButtonTitle:@"取回 " otherButtonTitles: nil];

        HDMyPositionViewController *myPositionVC = [[HDMyPositionViewController alloc]init];

2、因此延迟调转,是原困初始化tababr的是原困不延迟跳转会冒出调转不进去的具体情况;所以所以做延迟跳转处置。

        [mutArray insertObject:myPositionVC atIndex:1];

    **/

}

- (void)viewDidLoad

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

刚进入后台的原本消息处置原本我用了本地推送!可不时需看我前边写的博客,为社 么处置刚进入后台接收推送的案例,链接

    if (![positionIdString isEqualToString:@""]) {

{

        [[NSUserDefaults standardUserDefaults] setObject:nil forKey:kSavePushMessage];

    [self setSelectedIndex:MainTabBarIndex_User];

        NSMutableArray *mutArray = [NSMutableArray arrayWithArray:selNavi.viewControllers];

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

说明:是原困具体情况1都代表app是原困结速英文时需重新启动,非要做本地存储,因此到tabbar页面的原本取出该存储值的对应id因此进行跳转。具体情况2、3  ,App的tabbar页面是原困所处可不时需注册一另有一个 通知在2、3的具体情况原本发送通知!

    NSError *err;

        [mutArray insertObject:myPositionVC atIndex:1];

   [selNavi pushViewController:vc animated:YES];

    vc.positionId = [positionId longLongValue];

{

    NSString * positionIdString = [dic stringValueForKey:@"positionId"];

    [[NSUserDefaults standardUserDefaults] setObject:optionsRemoteNotificationKey forKey:kSavePushMessage];

注册监听tabbar的viewDidLoad最好的办法上方

    RootNavigationController* selNavi = [self.viewControllers objectAtIndex:MainTabBarIndex_User];

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

1、找到所进入的viewController的根导航Navigation;因此进行选中(self代表tabbar)  [self setSelectedIndex:MainTabBarIndex_User];

        }

        NSLog(@"json解析失败:%@",err);

1、存储调转

}

   NSDictionary *optionsRemoteNotificationKey = [launchOptions dictionaryValueForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];

    [self setSelectedIndex:MainTabBarIndex_User];

        HDMyPositionViewController *myPositionVC = [[HDMyPositionViewController alloc]init];

    /**二次启动获得推送点击信息,本地储存二次启动的内容 仿qq点击推送栏启动 by peter***/

        selNavi.toolbar.hidden = YES;

2、通知跳转

-(void)pushDispanchPositionDetail:(NSNotification *)notify

    HHPositionDetailC *vc = [[HHPositionDetailC alloc] init];

在tabbar的viewDidAppear最好的办法

原本就能点推送进入C,返回B,在返回所时需的tabbar的某个界面。

 1、apns的原本,结速英文程序退出后台:启动的原本可在 didFinishLaunchingWithOptions的launchOptions中处置;

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{

        [selNavi pushViewController:vc animated:YES];

/**

    });

    NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData

获取字典 launchOptions 中的 UIApplicationLaunchOptionsRemoteNotificationKey的key

    NSString *appDataString = [optionsRemoteNotificationKey stringValueForKey:@"appData"];

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

        [[NSNotificationCenter defaultCenter] postNotificationName:kString_DispantData object:positionIdString];

 **/

 注释:打开推送的三种最好的办法:-peter

    });

    NSString *  appData = [userInfo stringValueForKey:@"appData"];

        NSString * positionIdString = [NSString stringWithFormat:@"%@",[dic numberValueForKey:@"positionId"]] ;

}

}

}

    NSString * str = [NSString stringWithFormat:@"%@",launchOptions];

 2、apns的原本,结速英文程序未退出后台:启动的原本可在 didReceiveRemoteNotification的userInfo中处置;

    if (notify.object&&![notify.object isEqualToString:@""]) {

{

- (void)pushData:(NSString *)positionId{

 3、本地推送,未结速英文程序未退出后台(此方达为了处置消息刚进入后台原本这样通知的具体情况):启动的原本可在 didReceiveLocalNotification的notification中处置;

    }

        selNavi.viewControllers = [mutArray copy];

 最好的办法接收

    if (appDataString&&![appDataString isEqualToString:@""]) {

    }

   NSDictionary *optionsRemoteNotificationKey = [launchOptions dictionaryValueForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];

    });

}

    }

    vc.positionId = [positionId longLongValue];

        selNavi.viewControllers = [mutArray copy];

    HHPositionDetailC *vc = [[HHPositionDetailC alloc] init];

    if(err)

        if ([dic numberValueForKey:@"positionId"] !=0) {

        [art show];

{

3、找到当前的viewControllers数组,创建时需返回的二级页面加入栈中!

            [[NSNotificationCenter defaultCenter] postNotificationName:kString_DispantData object:positionIdString];

    [super viewDidAppear:animated];

二、处置页面跳转功能

        selNavi.toolbar.hidden = YES;

        NSMutableArray *mutArray = [NSMutableArray arrayWithArray:selNavi.viewControllers];

#pragma mark observer Notification

    NSData *jsonData = [appData dataUsingEncoding:NSUTF8StringEncoding];

        [self pushData:notify.object];

                                                        options:NSJSONReadingMutableContainers

    }else{

    }