Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. - (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary*) userInfo {
  2. **if ([self.profileManager.profile.userId isEqualToString:[[userInfo objectForKey:@"payload"] objectForKey:@"userId"]]**) {
  3. if (application.applicationState == UIApplicationStateActive) {
  4. UIRemoteNotificationType apnsType = [application enabledRemoteNotificationTypes];
  5. if(apnsType != UIRemoteNotificationTypeNone) {
  6. if((apnsType & UIRemoteNotificationTypeAlert) != 0) {
  7. [self showNotificationAlert:userInfo];
  8. }
  9.  
  10. if((apnsType & UIRemoteNotificationTypeBadge) != 0) {
  11. NSString* badge = [userInfo valueForKey:@"badge"];
  12. application.applicationIconBadgeNumber = [badge intValue];
  13. }
  14. }
  15. } else {
  16. NSString* event = [[userInfo objectForKey:@"payload"] objectForKey:@"event"];
  17. if ([event isEqualToString:@"QUESTION_ANSWERED"]) {
  18. [self presentYouAsked];
  19. } else if ([event isEqualToString:@"QUESTION_ASKED"]) {
  20. [self presentFriendsAsked];
  21. }
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement