Not receiving Push Notifications Using firebase and Objective C

前端 未结 3 1544
心在旅途
心在旅途 2021-01-27 16:45

I am trying to use Firebase for push notification. i have successfully installed the Firebase And Firebase messaging via Cocoapods

相关标签:
3条回答
  • 2021-01-27 17:29

    you need to create an App ID in your developer account that has the push notification entitlement enabled. Luckily, Xcode has a simple way to do this. Go to App Settings -> Capabilities and flip the switch for Push Notifications to On. After some loading, it should look like this: push notifications

    Also check p12 certificate is set for Firebase as it uses .p12 certificate for push notifications.

    0 讨论(0)
  • 2021-01-27 17:39

    You must call [[UIApplication sharedApplication] registerForRemoteNotifications]; to properly register for remote notifications.

    Configuring Remote Notifications For Background Usage

    Have you configured your app's background modes to accept remote notifications? You can do this by clicking: Project Name -> Capabilities -> Background Modes

    Turn this on and then tick the box beside Remote Notifications as seen in the screenshot below.

    0 讨论(0)
  • 2021-01-27 17:39

    You should be calling (iOS 8+) registerForRemoteNotifications, not isRegisteredForRemoteNotifications.

    Otherwise, you'll never get "high priority" messages from the Firebase server, delivered natively using APNS.

    Please note that when you're running in XCode, you are running in sandbox mode, so be sure to register with the proper parameters.

    Try sending it in "high priority" and see if your payload is in the proper APNS format:

    {
        "aps" : {
            "alert" : "You got your emails.",
            "badge" : 9,
            "sound" : "bingbong.aiff"
        },
    }
    

    Note that your payload may have = instead of :, which is acceptable.

    0 讨论(0)
提交回复
热议问题