推送通知

发布于 2024-12-02 18:42:16 字数 927 浏览 1 评论 0原文

我使用的服务器链接 http://stefan.hafeneger.name/download/PushMeBabySource.zip

我将 PushMeBaby 服务器和推送应用程序与我的证书和配置文件一起使用,它以警报的形式在设备上发出通知,并仅在我第一次运行该应用程序时在控制台上打印以方法编写的语句,但在下次运行该应用程序时多次测试它只返回设备令牌,以下方法根本不执行。请帮我解决这个问题。

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

    for (id key in userInfo) {
    NSLog(@”key: %@, value: %@”, key, [userInfo objectForKey:key]);

    UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@”alert” message:key delegate:self cancelButtonTitle:@”ok” otherButtonTitles:nil];
    [alert show];

    /*if(key)
    {

    UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@”alert” message:@”this is in application” delegate:self cancelButtonTitle:@”ok” otherButtonTitles:nil];
    [alert show];
    }*/

    }
}

请尽快帮助我

link for server I used http://stefan.hafeneger.name/download/PushMeBabySource.zip

I used PushMeBaby server and push app with my certificate and provisioning profile,it gave notification in form of alert on device and print the statement on console written in method only when first time I ran the application,but while running the application for next multiple times for testing it returns only device token,the following method doesnt execute at all.Please help me solving this problem.

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

    for (id key in userInfo) {
    NSLog(@”key: %@, value: %@”, key, [userInfo objectForKey:key]);

    UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@”alert” message:key delegate:self cancelButtonTitle:@”ok” otherButtonTitles:nil];
    [alert show];

    /*if(key)
    {

    UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@”alert” message:@”this is in application” delegate:self cancelButtonTitle:@”ok” otherButtonTitles:nil];
    [alert show];
    }*/

    }
}

Please help me as soon as possible

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

放飞的风筝 2024-12-09 18:42:16

每次启动应用程序时都需要获取令牌。有时它会改变。

You need to get the token every time you start the application. Sometimes it changes.

简单爱 2024-12-09 18:42:16
The delegate (didReceiveRemoteNotification) gets invoked when a running application receives a remote notification.  

If you implement application:didFinishLaunchingWithOptions: to handle an incoming push notification that causes the launch of the application, this method (didReceiveRemoteNotification) is not invoked for that push notification.

有关推送通知的详细信息,请参阅:
开发人员 apple-ApplePushService

The delegate (didReceiveRemoteNotification) gets invoked when a running application receives a remote notification.  

If you implement application:didFinishLaunchingWithOptions: to handle an incoming push notification that causes the launch of the application, this method (didReceiveRemoteNotification) is not invoked for that push notification.

For details about push notifications see:
developer apple-ApplePushService

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文