1

I had coded in ios to receive Notifications sent from "AWS SNS", notification is received if i connect the device directly to xcode and run, if i created ipa from xcode version less than 6 or ipa generation through iTunes then notification received perfectly. If i generate ipa from any xcode 6 version then notification is not received, how to fix this ? And i am using Development provisioning profile and development certificate with Push notification service enabled.

didFinishLaunchWithOptions code

if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge
                                                                                             |UIRemoteNotificationTypeSound
                                                                                             |UIRemoteNotificationTypeAlert) categories:nil];
        [application registerUserNotificationSettings:settings];
    } else {
        UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;
        [application registerForRemoteNotificationTypes:myTypes];
    }

#ifdef __IPHONE_8_0
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
    //register to receive notifications
    [application registerForRemoteNotifications];
}

- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler
{
    [self showAlertIfNotificationReceives: userInfo];
    //handle the actions
    if ([identifier isEqualToString:@"declineAction"]){
    }
    else if ([identifier isEqualToString:@"answerAction"]){
    }
}
#endif

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken{
NSLog(@"deviceToken: %@", deviceToken);
// Register with AWS SNS
}

- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error{
    NSLog(@"Failed to register with error : %@", error);
}

//Handle Notification if App is Open
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
    NSLog(@"SNS Notification userInfo: %@",userInfo);
}

I am receiving device token and registered with AWS SNS successfully, but i am not receiving a notification only with ipa of xcode 6 version. Advance thanks for any help.

Sakthimuthiah
  • 2,606
  • 6
  • 26
  • 41

1 Answers1

2

XCode version 6.4 automatically takes "Distribution Certificate" to generate ipa even though "Development certificate and development provisioning profile were selected"(I don't know why)

Problem is : App registers in Production APNS because of xcode automatic selection of Distribution certificate for ipa generation and AWS SNS APNS Sandbox Server is a trying to send notification to Production APNS Server Device Token.

Finally, AWS SNS Production Application created to send notifications

Sakthimuthiah
  • 2,606
  • 6
  • 26
  • 41