3

APNS を使用して IOS デバイスにプッシュ通知を送信する WCF サービスがあります。PushSharp を使用して次のコードを使用します。

「RegisterAppleService」ステップでエラーが発生しました。エラーの説明は次のとおりです。 「CryptographicException はユーザー コードによって処理されませんでした。パラメーターが正しくありません。」

    private static PushBroker push;

    public string SendNotification()
    {
        push = new PushBroker();
        push.OnNotificationSent += NotificationSent;
        push.OnChannelException += ChannelException;
        push.OnServiceException += ServiceException;
        push.OnNotificationFailed += NotificationFailed;
        push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
        push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
        push.OnChannelCreated += ChannelCreated;
        push.OnChannelDestroyed += ChannelDestroyed;

        var appleCert = File.ReadAllBytes("CERT_FILE_NAME.p12");
        push.RegisterAppleService(new ApplePushChannelSettings(appleCert, "PASSWORD"));

        string devToken = "DEVICE_TOKEN";
        push.QueueNotification(new AppleNotification()
                                   .ForDeviceToken(devToken)
                                   .WithAlert("Hello World!")
                                   .WithBadge(7)
                                   .WithSound("sound.caf"));

問題の原因がわかりませんでした。その例外をどのように処理できますか? ありがとうございました。

4

1 に答える 1