在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];
}
}