我的應用程序很容易在推送通知中接收少於256字節,但對於iOS 8,它能夠在推送通知中接收2K有效負載,我無法接收該消息。不接收推送通知大於256字節iOS 8
在我使用Asp.net及以下服務器端是我的有效載荷:
{"aps":{"alert":"ASD SAD SA DAS DSDSADSAD E36DCB20B9497BB75BE6BF0C47718C73E8D80A6B734F296BD768DC5C4DB261BCE36DCB20B9497BB75BE6BF0C47718C73E8D80Assdds","id":"5","type":"n","sound":"default","category":"1"}}
我使用iPhone 5S與iOS 8.1進行測試。
在iOS端我使用下面的代碼
UIApplication *application = [UIApplication sharedApplication];
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)])
{
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge |
UIUserNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes categories:nil];
[application registerUserNotificationSettings:settings];
[application registerForRemoteNotifications];
}
else
{
// Register for Push Notifications before iOS 8
[application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeSound)];
}
你是如何發送推?也許發送服務器限制推送到256字節,因爲這是前8限制 – Paulw11
我不確定發送服務器的限制設置,但我已經創建有效載荷小於256和更大,然後256並且都發送平穩但設備上未收到大於256的數據。 –
服務器可能有代碼將有效負載修剪爲256(或者默默丟棄它 - 我不確定你在設備上獲得什麼) – Paulw11