Pu sh Расширение службы уведомлений в iOS не выполняется - PullRequest
0 голосов
/ 13 января 2020

Итак, я создал iOS Расширение службы уведомлений в формах Xamarin в соответствии с указанным здесь руководством [https://docs.microsoft.com/en-us/xamarin/ios/platform/user-notifications/enhanced-user-notifications?tabs=windows] [1]

Это мой код расширения, его точно так же, как в примере, описанном выше

 [Register("NotificationService")]
public class NotificationService : UNNotificationServiceExtension
{
    Action<UNNotificationContent> ContentHandler { get; set; }
    UNMutableNotificationContent BestAttemptContent { get; set; }

    protected NotificationService(IntPtr handle) : base(handle)
    {
        // Note: this .ctor should not contain any initialization logic.
    }

    public override void DidReceiveNotificationRequest(UNNotificationRequest request, Action<UNNotificationContent> contentHandler)
    {
        ContentHandler = contentHandler;
        BestAttemptContent = (UNMutableNotificationContent)request.Content.MutableCopy();

        // Modify the notification content here...
        BestAttemptContent.Title = $"{BestAttemptContent.Title}[modified]";

        ContentHandler(BestAttemptContent);
    }

    public override void TimeWillExpire()
    {
        // Called just before the extension will be terminated by the system.
        // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.

        ContentHandler(BestAttemptContent);
    }
}

Но я не могу отладить полезную нагрузку уведомлений и не могу получить уведомление, происходит регистрация, поэтому я предполагаю, что моя конфигурация верно, но расширение службы не запускается

Если я что-то упустил, любые входные данные были бы полезны, к сожалению, я использую Azure Центр уведомлений для этого

1 Ответ

0 голосов
/ 13 января 2020

Убедитесь, что вы подписали приложение с точным профилем пакета, а не с подстановочным профилем, и помните, что уведомления не поддерживаются в симуляторе, все это применяется, пока "регистрация все еще будет происходить".

Когда при сомнениях проверьте, что ваши уведомления работают в ad-ho c релизе на реальном устройстве, если да, то причина была выше.

...