接到通知APNS但不显示 [英] APNS notification received but not display

查看:491
本文介绍了接到通知APNS但不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现pushnotification。我得到当应用程序正在运行状态推送的消息。

I am trying to implement pushnotification. I get pushed message when app is running state.

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

NSLog(@"\n\n\n apns==%@\n\n\n",userInfo);


}

我的问题是,当我推消息,当应用程序没有运行手段的徽章只算显示的应用程序图标。它不会像显示关闭和视图按钮报警。即使我CONT predict

my problem is when I pushed message when app is not running means badge count only show on the app icon. It will not display the alert like close and view buttons. Even I cont predict

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    NSLog(@"\n\n\n\apns==%@\n\n\n\n",launchOptions);
}

我也查在设置 - >通知 - >对myApp - >选择徽章,声音,警报

I checked also in settings --> Notifications --> myApp --> choose badges, sounds, alerts

我用下面的配置:

MAC OS 10.9

Mac os 10.9

X $ C $ç5.0.2

xcode 5.0.2

IOS 7.0

请咨询我。

我想这个消息。

先谢谢了。

推荐答案

您必须设置警报视图显示您的到来推送通知信息,如:

You have to setting Alert view for Displaying your coming Push notification Message like:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
    if (application.applicationState == UIApplicationStateActive)   
    {
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"App Notification" message:[NSString stringWithFormat:@"%@",[[userInfo objectForKey:@"aps"] objectForKey:@"alert"]]delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alertView show];
    }
}


当苹果公司的在后台模式或关闭那么管理器应用程序,你不能处理它。你必须从设备设置警报提示 - >设置。你徽章显示,因为你自动功能徽章指望它是一个整数值,以便自动设置。只要设置推送通知,设备设置 - >设置 - >通知中心--->找到你的应用程序 - >选择它并显示如下:


when your application in Background Mode or close then that manager by apple you can't handle it. you have to setting Alert prompt from device-->setting. And you badge Display because that automatically functionality of you badge count it's an integer value so that setting automatically. just set push notification setting from device--> setting-->Notification Center--->find your App--->select it and that display like:

更新:

您推Notificaton有效载荷JSON甲应该是这样的:

Your push Notificaton Payload JSON formate should look like this:

{
    "aps": {
         "badge": 10,
         "alert": "Hello world!",
         "sound": "cat.caf"
    }
}

这篇关于接到通知APNS但不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆