iOS开发关于远程推送页面跳转
2016-01-21 15:03
676 查看
在AppDelegate 里面解析推送信息,以及转跳界面
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler
{
// NSError *parseError = nil;
// NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo
// options:NSJSONWritingPrettyPrinted error:&parseError];
// NSString *str = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"apns.content", @"Apns content")
// message:str
// delegate:nil
// cancelButtonTitle:NSLocalizedString(@"ok", @"OK")
// otherButtonTitles:nil];
// [alert show];
NSString * type = [userInfo objectForKey:@"f"];
if (application.applicationState == UIApplicationStateActive) {
}
else if(application.applicationState == UIApplicationStateInactive){
[self performSelector:@selector(pushViewAction:) withObject:type afterDelay:0.1];
}
}
- (void)pushViewAction:(NSString *)type{
if (mianController) {
[mianController
notificationPush:type];
}
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler
{
// NSError *parseError = nil;
// NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo
// options:NSJSONWritingPrettyPrinted error:&parseError];
// NSString *str = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"apns.content", @"Apns content")
// message:str
// delegate:nil
// cancelButtonTitle:NSLocalizedString(@"ok", @"OK")
// otherButtonTitles:nil];
// [alert show];
NSString * type = [userInfo objectForKey:@"f"];
if (application.applicationState == UIApplicationStateActive) {
}
else if(application.applicationState == UIApplicationStateInactive){
[self performSelector:@selector(pushViewAction:) withObject:type afterDelay:0.1];
}
}
- (void)pushViewAction:(NSString *)type{
if (mianController) {
[mianController
notificationPush:type];
}
}
相关文章推荐
- 教你如何使用xcode 生成 自定义注释和API 2
- iOS 【通知】
- 教你如何用xcode生成api文档 1
- SSZipArchive使用详解
- iOS 本地缓存简述
- IOS多线程开发其实很简单
- iOS 检测版本更新
- iOS NSDate相关
- IOS界面通信-代理(协议)传值
- iOS相册访问权限
- iOS证书及ipa包重签名探究
- iOS开发之AsyncSocket使用教程
- iOS 开发里使用MVC编程模式项目
- ios开发 导入.a后导致出现静态库代码冲突
- ios 使用FFMPEG
- ios编程--AVCapture编程理解(视频输入输出--摄像头)
- ios remote control
- iOS开发常用技巧
- IOS-问题汇总
- IDFA - 3