From d290f26b394b3e85c44cbae9fd9a493e0cb54efb Mon Sep 17 00:00:00 2001 From: wu736139669 Date: Sun, 28 Jun 2015 17:49:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AE=E4=BF=A1=E7=9A=84?= =?UTF-8?q?=20url=20scheme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcdebugger/Breakpoints_v2.xcbkptlist | 44 ++++++++++++++++--- Ash_AWord/AppDelegate.m | 42 +++++++++++++++--- Ash_AWord/Info.plist | 2 +- 3 files changed, 74 insertions(+), 14 deletions(-) diff --git a/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index c457dfd..4d26c04 100644 --- a/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -166,7 +166,7 @@ + + + + + + + + diff --git a/Ash_AWord/AppDelegate.m b/Ash_AWord/AppDelegate.m index 1152069..6dcaf72 100644 --- a/Ash_AWord/AppDelegate.m +++ b/Ash_AWord/AppDelegate.m @@ -14,8 +14,11 @@ #import "MobClick.h" #import "MainViewController.h" #import "EaseMob.h" -@interface AppDelegate () - +#import "PersonalInfoViewController.h" +@interface AppDelegate () +{ + NSString* _otherUserId; +} @end @implementation AppDelegate @@ -24,11 +27,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. - - - - - + _otherUserId = nil; application.applicationIconBadgeNumber = 0; if([application respondsToSelector:@selector(registerUserNotificationSettings:)]) @@ -127,6 +126,8 @@ // 打印收到的apns信息 -(void)didReceiveRemoteNotification:(NSDictionary *)userInfo { + [MBProgressHUD errorHudWithView:nil label:@"hha" hidesAfter:1.0]; + NSError *parseError = nil; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo options:NSJSONWritingPrettyPrinted error:&parseError]; @@ -140,6 +141,33 @@ [alert show]; } +- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler +{ + NSError *parseError = nil; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo + options:NSJSONWritingPrettyPrinted error:&parseError]; + NSString *str = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + + NSString* info = [[userInfo objectForKey:@"aps"] objectForKey:@"alert"]; + _otherUserId = [userInfo objectForKey:@"f"]; + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"收到消息" + message:info + delegate:self + cancelButtonTitle:NSLocalizedString(@"ok", @"OK") + otherButtonTitles:@"点击查看",nil]; + [alert show]; + +} +-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex +{ + if (buttonIndex == 1 && _otherUserId && ![_otherUserId isEqualToString:@""]) { + + PersonalInfoViewController* personalInfoViewController = [[PersonalInfoViewController alloc] initWithNibName:@"PersonalInfoViewController" bundle:nil]; + personalInfoViewController.hidesBottomBarWhenPushed = YES; + personalInfoViewController.otherUserId = _otherUserId; + [[AppDelegate visibleViewController].navigationController pushViewController:personalInfoViewController animated:YES]; + } +} - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { return [UMSocialSnsService handleOpenURL:url]; diff --git a/Ash_AWord/Info.plist b/Ash_AWord/Info.plist index 684e3ef..e764310 100644 --- a/Ash_AWord/Info.plist +++ b/Ash_AWord/Info.plist @@ -49,7 +49,7 @@ weixin CFBundleURLSchemes - wx8fbd37e4da758bbd + wx557ac33ef4304d7c