Not receiving any push notification in iPhone

| | August 11, 2015

I have made a sample PushTest app for Push Notification using this tutorial.

And using above tutorial I got the message that ‘PushTest’ would like to send you Push Notification (exactly once) and after that I delete the app from iPhone, restart the iPhone but unable to get the same message again.

I have run the script sample.php (updating the changes suggested) and got the message ‘connected to APNS’ & ‘your message send’.

But I didn’t receive any single push notification.

Please guide me where I am wrong?
Or what shod I try for push notification receive.

4 Responses to “Not receiving any push notification in iPhone”

  1. You will not receive Push only in 2 cases

    1.) If your application is in foreground.

    2.) you device token is not valid for receiving the push notification please check both the condition if you still do not receive push please let me know.
    Thanks

  2. Please check in your device’s Settings if notifications for the application are on and ensure that the type of the notification is not ‘None’ in Notification Center.

  3. I have followed the same tutorial.

    Make sure your app is listed in notification center, and it’s alert type is anything but not none.

    You need to check your notification in 3 conditions,

    When your app is open, in background, and when closed.

    For that, you need to in check these methods

    // To Register your device token
    - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
    

    //If your app is not able to register
    - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
    {}
    

    //Your app receives push notification.
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
    {
    
        UIApplicationState state = [application applicationState];
    
        // If your app is running
        if (state == UIApplicationStateActive)
        {
    
            //You need to customize your alert by yourself for this situation. For ex,
            NSString *cancelTitle = @"Close";
            NSString *showTitle = @"Get Photos";
            NSString *message = [[userInfo valueForKey:@"aps"] valueForKey:@"alert"];
            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@""
                                                                message:message
                                                               delegate:self
                                                      cancelButtonTitle:cancelTitle
                                                      otherButtonTitles:showTitle, nil];
            [alertView show];
            [alertView release];
    
        }
        // If your app was in in active state
        else if (state == UIApplicationStateInactive)
        {
        }
    }
    
  4. Make sure you are using push notification enabled provisioning profile. and then check if you are sending token to server.

Leave a Reply