2016-06-22 39 views
0

我有一个ios项目pushnotification当从后端添加任何事件启用。所有工作都很好;显示badgealertsound一切正常,但'banner'除外。当应用程序处于背景模式时,横幅未显示,我认为从我们身边没有任何代码可用于“横幅”。这是我如何注册pushnotificationPushnotification横幅没有显示 - ios9

UIUserNotificationType types = UIUserNotificationTypeBadge | 
     UIUserNotificationTypeSound | UIUserNotificationTypeAlert; 

     UIUserNotificationSettings *mySettings = 
     [UIUserNotificationSettings settingsForTypes:types categories:nil]; 

     [[UIApplication sharedApplication] registerUserNotificationSettings:mySettings]; 
     [[UIApplication sharedApplication] registerForRemoteNotifications]; 
+0

您是在模拟器还是在iDevice上运行您的应用程序?推送通知不会显示在模拟器上。 –

+0

你注册了你的设备令牌吗? –

+0

@GijsSotthewes我在设备上运行,我收到每个通知,我只在通知触发时显示横幅问题。 –

回答

0

这是因为从后端发送的有效载荷超过了允许的大小限制。 按照允许的official doc最大尺寸为:

  • 对于常规远程通知,最大大小为4KB(4096个 字节)
  • 对于因特网协议语音(VoIP)的通知,则最大 大小是5KB (5120字节)NOTE