Lior Z
Lior Z

Reputation: 668

Push Notification not calling didReceiveRemoteNotification when app in background

I have an iOS app and I get push notifications from my server. I've set content-available to be 1 in the json I'm sending to APNS and also set the flags for the background capabilities in my app.

The push notification comes, however when the app is in the background didReceiveRemoteNotification is not called - and I really need to, since I want to show a banner for my user.

Can anyone tell what I'm doing wrong?

Thanks

Notification:

aps = { alert = { "action-loc-key" = "This is button message"; body = "This is an iOS message"; }; badge = "-1"; sound = default; "content-available" = 1 };

Upvotes: 1

Views: 1904

Answers (1)

Vlad Papko
Vlad Papko

Reputation: 13302

If application in background mode then method - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo won't be called automatically when push notification appears.
This method would be called only in case if user taps on push notification alert or banner.

Upvotes: 0

Related Questions