UIChris
UIChris

Reputation: 621

Silent notification working weird in iOS7 without wifi

I'm using silent notifications, which works perfectly when my phone is plugged to Xcode, using Wifi, and with a breakpoint in the application:didReceiveRemoteNotification:fetchCompletionHandler: method, when my app is in background.

My server is sending a silent notification every minutes. Here is my payload :

{
    aps = 
    {
        "content-available" = 1;
    };
    "update-location" = 1;
}

BUT, when I disable the WIFI from my phone, it doesn't receive it anymore (3g is working as usual).

I got the same behavior when I'm not plugged to Xcode.

Does anyone have a idea, or already solved it?

Upvotes: 1

Views: 481

Answers (3)

user376845
user376845

Reputation:

I'd do the following two things first to help me narrow down the possibilities:

  1. Check what APNS gateway you're using. If you're using a distribution certificate, don't fire your notifications at the sandbox APNS URL.
  2. Make sure you're using the matching provisioning profile on the device. Development profiles & distribution profiles return different UDIDs.

Also, as Viruss mca said, sometimes there's a lag from Apple's servers.

UPDATE: You've also got a semi-colon in there.

aps = 
{
    "content-available" = 1;
};// << Right there. It should be a comma.

Upvotes: 2

UIChris
UIChris

Reputation: 621

Solution : Add the sound key in the silent notification content....

Upvotes: 2

Toseef Khilji
Toseef Khilji

Reputation: 17419

I guess there may two points in your case,

  1. Dont send too many notifications to a device within a short span of time, coz APNS caches only 1 message/device (if the device is offline). So it can deliver the message when the device comes online. Am not sure how long the message is cached though.

  2. APNS is based on Apple Servers, and Apple doesn't give any guarantee on successful message delivery.

it quite clearly in the Apple Docs that it is not 100% gauranteed and nor should it be used as so

Upvotes: 1

Related Questions