Forum Xamarin.iOS

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Need help getting push notifications to work.

I've searched on here but haven't found my answer yet. There seem to be many similar questions but none of the fixes work for me.

The error I'm getting is: "no valid “aps-environment” entitlement string found for application".

I'm using this tutorial: https://docs.microsoft.com/en-us/azure/notification-hubs/xamarin-notification-hubs-ios-push-notification-apns-get-started

I'm running iOS 11 and macOS Sierra.

I've followed all of the directions on the tutorial as far as creating the appropriate certificates, creating the app ID, the provisioning profile, exporting the .p12 file and uploading it to Azure Notification Hub and all of that works exactly as expected.

The App ID has "Push Notifications" enabled and there's a yellow circle by "Configurable". I've created the Developmenet SSL Certificate for the push notification, which is what gets uploaded to the Azure Notification Hub.

Still, though, I get that error. The app starts, asks for permission for push notifications, then hits the "FailedToRegisterForRemoteNotifications" method.

What's odd to me is that when I open the entitlements.plist, "Enable Push Notifications" is not checked. If I try to check that, then when I start the app it tells me it can't run because the entitlements don't match what is set in the app ID.

Can anybody help me out and get me going in the right direction? I've tried deleting everything (app IDs, certs, provisioning profiles) multiple times. Including deleting the certs that are installed into Keychain Access.

Answers

  • Nobody has any insight on this?

  • PeterMarshPeterMarsh FRMember ✭✭
    edited February 2018

    Hello,

    I've had something similar to this. I can't remember what error I had exactly (happened a while back) but, when in Debug I had to add:

    <dict>
        <key>aps-environment</key>
        <string>development</string>
    </dict>
    

    and when in Release:

    <dict>
        <key>aps-environment</key>
        <string>production</string>
    </dict>
    

    Hope this helps.

  • Raf3DRaf3D Member ✭✭

    Hi All.

    I am experiencing the same issue with the same tutorial, but I have found now wy to fix it!

    This is what I have in my Entitlements.plist file

    <?xml version="1.0" encoding="UTF-8"?>



    aps-environment
    development

    Despite the fact that I swap the string between development or production I always have the same error message:

    "no valid “aps-environment” entitlement string found for application"

    @ChrisAnderson.0966 have you solved the problem please?

Sign In or Register to comment.