Apple Push Services for Phonegap App

0 votes
Hi!

I need to implement Push services for my Apple App. As,  I am very new to the designing of iPhone Apps so i am unable to implement push services for my app. Need help.

Thanks!

Regards,

Prabhjas Singh
asked Nov 11, 2015 in App42 Cloud API-BaaS by prabhjassinghbajwa (25 points)

1 Answer

0 votes
 
Best answer

Hello Prabhjas,

You can follow this tutorial to create certificates, provisional profile and .p12 files required forApple push notification. 

Let me know if you face any problem.

Thanks.

answered Nov 12, 2015 by rajeev.etc (1,660 points)
selected Nov 20, 2015 by prabhjassinghbajwa
Can you explain the problem in more detail? What is the problem you are facing? What do you mean by need help in selecting messages? Please provide more detail, it will really help me to understand the problem.
When I send push notification it is getting received at user end in its notification bar. But when I click on that message it just opens my app and I'm unable to see that notification. So help I need is could you please provide me the code by which on clicking that message it shows that push notification to the user and in background app should get opened.
Showing UI depends on the developer but the push payload at client side can be received in the delegate method in AppDelegate.m as follows:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
       NSLog(@"%s..userInfo=%@",__FUNCTION__,userInfo);
      /**
       * Dump your code here according to your requirement after receiving push
       */
}

Please place the above delegate method in the AppDelegate and parameter userInfo will be the push payload. You can just print userInfo to get its structure and then you can fetch the required value by passing the proper key.
Trying with this code.

  */
    if (state == UIApplicationStateActive) {
        NSString *cancelTitle = @"Close";
        NSString *showTitle = @"Show";
        NSString *message = [[userInfo valueForKey:@"aps"] valueForKey:@"alert"];
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Some title"
                                                            message:message
                                                           delegate:self
                                                  cancelButtonTitle:cancelTitle
                                                  otherButtonTitles:showTitle, nil];
        [alertView show];
        [alertView release];
    } else {
        //Do stuff that you would do if the application was not active
    }

But it says undeclared identifier state.
In last i must say you helped me lot and thanks a lot. Now I'm able to see push messages as well.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...