Unable to receive background push notifications

Hi,

I've been trying to integrate UA with my iOS app. I followed the instructions as posted in the QuickStart. I am able to see the UA console output and obtain a channel ID there. When I lookup the device using the channel ID, it has "Opted In" listed as red. This is despite the fact that I allowed notifications when my app launched.

 

As a result, I don't receive push notifications. If I go into the app settings and toggle "Background App Refresh" off then on again and then do another device lookup on UA, it now shows my app as being "Opted In" (turns green). It also now has a Push address listed. However, I still can't receive push notifications.

 

Could my APN cert by bad? It doesnt appear to be. Any help or direction you can provide is greatly appreciated!

Didn't find what you were looking for?

New post

Comments

14 comments

  • Hi Eric,

    Looking at your app today, it looks like you are getting sends to go out to your iOS device. Are you still having issues?

    Thank you,
    Sean Conlin
    Urban Airship Technical Support
    Portland, Oregon

    Comment actions Permalink
    0
  • Hi Sean,

     

    So I was right about the cert being bad. I generated it incorrectly. After fixing this things were working. However, as of this afternoon, I am once again not receiving pushes though I see the channel ID in the iOS logs. "Opted in" is always red even though I have notifications enabled.

     

    I changed the way the UA libraries were included so that I could include it as a separate module. At first, I thought that was the issue, but even when I go back to the structure that was working it still does not work.

     

    Android works fine.

    Comment actions Permalink
    0
  • Are you getting no valid "aps-environment" entitlement string found for application when you launch the app on your device from Xcode?

    If so, this documentation may help:
    http://docs.urbanairship.com/reference/troubleshooting/ios-registration.html#no-push-request-alert

    Because Android is working, this makes me think it is a provisioning profile issue.

    Comment actions Permalink
    0
  • Nothing about aps-entitlements. Heres some device logs if it helps. I've replaced anywhere there was an ID with constants such as CHANNEL_ID.

     

    On first app load:

    2016-04-28 09:54:05.840 [393:26079] [I] +[UAirship executeUnsafeTakeOff:] [Line 205] UAirship Take Off! Lib Version: 7.1.0 App Key: APP_KEY Production: NO.
    2016-04-28 09:54:05.842 [393:26079] [D] +[UAirship executeUnsafeTakeOff:] [Line 213] Setting User-Agent for UA requests to 96 (iPhone; iPhone OS 9.3.1; UALib 7.1.0; USER_AGENT_ID; en_US)
    2016-04-28 09:54:05.894 [393:26079] [D] -[UAPush updateChannelRegistrationForcefully:] [Line 897] Channel registration is currently disabled.
    2016-04-28 09:54:05.902 [393:26079] [D] -[UANamedUser update] [Line 61] New or re-install, skipping named user update.
    2016-04-28 09:54:05.972 [393:26142]
    2016-04-28 09:54:06.031 [393:26079] [I] +[UAirship executeUnsafeTakeOff:] [Line 282] Automatic setup enabled.
    2016-04-28 09:54:06.031 [393:26079] [D] +[UAAppDelegateProxy swizzle:implementation:class:] [Line 106] Adding implementation for application:handleActionWithIdentifier:forRemoteNotification:completionHandler: class LLAppDelegateProxy
    2016-04-28 09:54:06.032 [393:26079] [D] +[UAAppDelegateProxy swizzle:implementation:class:] [Line 106] Adding implementation for application:handleActionWithIdentifier:forRemoteNotification:withResponseInfo:completionHandler: class LLAppDelegateProxy
    2016-04-28 09:54:06.032 [393:26079] [D] +[UAAppDelegateProxy swizzle:implementation:class:] [Line 106] Adding implementation for application:didReceiveRemoteNotification:fetchCompletionHandler: class LLAppDelegateProxy
    2016-04-28 09:54:06.032 [393:26079] [D] +[UAAppDelegateProxy swizzle:implementation:class:] [Line 106] Adding implementation for application:didReceiveRemoteNotification: class LLAppDelegateProxy
    2016-04-28 09:54:06.032 [393:26079] [D] +[UAAppDelegateProxy swizzle:implementation:class:] [Line 106] Adding implementation for application:didRegisterForRemoteNotificationsWithDeviceToken: class LLAppDelegateProxy
    2016-04-28 09:54:06.032 [393:26079] [D] +[UAAppDelegateProxy swizzle:implementation:class:] [Line 106] Adding implementation for application:didRegisterUserNotificationSettings: class LLAppDelegateProxy
    2016-04-28 09:54:06.033 [393:26079] [D] +[UAAppDelegateProxy swizzle:implementation:class:] [Line 106] Adding implementation for application:didFailToRegisterForRemoteNotificationsWithError: class LLAppDelegateProxy
    2016-04-28 09:54:06.033 [393:26079] [D] -[UAPush updateRegistration] [Line 883] APNS registration is out of date, updating.
    2016-04-28 09:54:06.033 [393:26079] [D] -[UAPush updateAPNSRegistration] [Line 1029] Registering for user notification types 7.
    2016-04-28 09:54:06.034 [393:26079] My Application Channel ID: (null)
    2016-04-28 09:54:06.189 [393:26079] [D] -[UAAnalytics addEvent:] [Line 252] Adding app_init event EVENT_ID.
    2016-04-28 09:54:06.190 [393:26079] [D] -[UAPush updateRegistration] [Line 888] Push is enabled but we have not yet generated a channel ID. Urban Airship registration will automatically run when the device token is registered, the next time the app is backgrounded, or the next time the app is foregrounded.
    2016-04-28 09:54:06.194 [393:26079] [D] -[UAInboxMessageList retrieveMessageListWithSuccessBlock:withFailureBlock:] [Line 128] Retrieving message list.
    2016-04-28 09:54:06.268 [393:26079] [I] __56-[UAInboxMessageList refreshInboxWithCompletionHandler:]_block_invoke_2 [Line 389] Inbox messages updated.
    2016-04-28 09:54:06.268 [393:26079] [D] __56-[UAInboxMessageList refreshInboxWithCompletionHandler:]_block_invoke_2 [Line 391] Loaded saved messages: (
    ).
    2016-04-28 09:54:06.750 [393:26079] [D] __59-[UAInboxAPIClient retrieveMessageListOnSuccess:onFailure:]_block_invoke_3 [Line 172] Setting Last-Modified time to '(null)' for user USER_ID's message list.
    2016-04-28 09:54:06.751 [393:26079] [D] __75-[UAInboxMessageList retrieveMessageListWithSuccessBlock:withFailureBlock:]_block_invoke73 [Line 166] Refreshing message list.
    2016-04-28 09:54:06.754 [393:26079] [I] __56-[UAInboxMessageList refreshInboxWithCompletionHandler:]_block_invoke_2 [Line 389] Inbox messages updated.
    2016-04-28 09:54:06.754 [393:26079] [D] __56-[UAInboxMessageList refreshInboxWithCompletionHandler:]_block_invoke_2 [Line 391] Loaded saved messages: (
    ).

     

    When the app is backgrounded:

    2016-04-28 09:56:41.730 [393:26079] [D] __47-[UAChannelRegistrar createChannelWithPayload:]_block_invoke [Line 146] Channel CHANNEL_ID created successfully. Channel location: https://device-api.urbanairship.com/api/channels/CHANNEL_ID.
    2016-04-28 09:56:41.732 [393:26079] Channel ID: CHANNEL_ID
    2016-04-28 09:56:41.734 [393:26079] Created channel with ID: CHANNEL_ID
    2016-04-28 09:56:41.735 [393:26079] [D] -[UANamedUser update] [Line 61] New or re-install, skipping named user update.
    2016-04-28 09:56:41.735 [393:26079] [I] -[UAPush registrationSucceededWithPayload:] [Line 1099] Channel registration updated successfully.
    2016-04-28 09:56:41.951 [393:26079] [I] __20-[UAUser updateUser]_block_invoke148 [Line 231] Updated user USER_ID successfully.
    2016-04-28 09:56:41.960 [393:26079] [D] __41-[UAAnalytics uploadOperationWithEvents:]_block_invoke [Line 537] Analytics data sent successfully. Status: 200

     

     

    I think you're right about it being something on Apple's side. I'll have to dig a little deeper there. Last time I had an issue, one of your employees was able to tell me that it appeared to be a problem with the cert. If you are able to give me any extra information there that would be awesome. Otherwise, thanks for your help and I'll see what I can find.

     

     

     

    Comment actions Permalink
    0
  • Hi Eric,

    Your certificate looks ok.

    Can you post a copy of your AppDelegate.m file?

    Thank you,
    Sean Conlin
    Urban Airship Technical Support
    Portland, Oregon

    Comment actions Permalink
    0
  • Here is the only UA related code (besides the import statement):

     

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    // ... Unrelated code here ...


    // Call takeOff (which creates the UAirship singleton)
    [UAirship takeOff];

    // User notifications will not be enabled until userPushNotificationsEnabled is
    // set YES on UAPush. Once enabled, the setting will be persisted and the user
    // will be prompted to allow notifications. Normally, you should wait for a more
    // appropriate time to enable push to increase the likelihood that the user will
    // accept notifications.
    [UAirship push].userPushNotificationsEnabled = YES;

    // ... Unrelated code here ...

    return YES;
    }

     

    No changes were made to this code in the time that it worked and stopped working.

    Comment actions Permalink
    0
  • I was about to start a topic when I read this, looks like the same problem I have been facing. Certificates seem in order, devices get registered correctly, but looking them up shows them as not installed and/or opted out, even though that's not the case. No push messages getting through :-(!

     

    My app delegate / logs look similar to Eric's. -- I do get a channel ID though when the app is launched.

    Comment actions Permalink
    0
  • Still facing the same issue. When I go into my App Settings and turn "Background Fetch" off and "Location Services" to Never and then back to "on" and "always", it finally registers me as having opted in, but this only happens if I manually turn those things off and then back on. Android works with no problem.

    Comment actions Permalink
    0
  • I still have the same issue. But I would generalise it as the problem appears at fresh install. After user grants access to notification I get in console log:

    [D] -[UAChannelRegistrar registerWithChannelID:channelLocation:withPayload:forcefully:] [Line 73] Ignoring registration request, registration is up to date.

    Although user granted access, so state should be updated. Did you guys managed to work around this ?

    Comment actions Permalink
    0
  • Any update here? I'm seeing a similar issue. I have two devices with my app installed (same build) & both have push notifications turned on. However, only one is receiving push notifications.

    When I look up "Devices" in the "Reports" tab, I only have 1 device instead of the 2 that should be there...

    Any help would be much appreciated

    Comment actions Permalink
    0
  • Hi guys, I found my problem, I was cleaning up my cache when my application was starting, but after UA initiated sqlite db, and by this I was deleting their db. After I fixed that, everything worked as it should. 

    Comment actions Permalink
    0
  • Hi everyone, has anyone figured out a fix for this. I am also experiencing the same issue where the apple device doesn't opt-in but the tags are updating perfectly fine when changed.

    Comment actions Permalink
    0
  • I was never able to resolve my issues. I ended up switching to another push provider. I will say though that in dealing with several different providers, generally the issues I've seen were created by mismatches between the specific certs, profiles, and scheme I was using. In one instance, I was building an app in the debug scheme, but didnt realize the provider I was using was sending by default to the production gateway. This created a mismatch of certificates and ultimately causes my push token to be rejected by Apple. The best advice I can give is make sure everything with your certs, profiles, and schemes lines up environment wise.

    Comment actions Permalink
    0
  • My issue dealt with how I was collecting permission for Push Notifications in app delegate.

    I needed to customize some of the functions for setting up Push Notifications so I wasn't able to use UA's auto setup.

    I was testing on two phones with identical builds BUT for "phone A" I collected Push Notification permissions on UA before customizing the setup & on "phone B" I collected Push Notification permissions after customizing the setup.

    Something I was doing in the custom app delegate functions was breaking & UA wasn't aware that "phone B" had permitted Push Notifications. Everything worked on "phone A" because UA had already registered that it permitted Push Notifications.

     

    Comment actions Permalink
    0

Please sign in to leave a comment.