5

我正在使用此代码向 iPhone 发送 Apple 推送通知:

Public Function SendPush() As String
    Dim rt As String = "Sended!"
    Dim deviceToken As String = "my token"
    Dim message As String = "Parabéns é Campeão!"
    Try

        Dim payLoad As New NotificationPayload(deviceToken, message, 1, "default")
        payLoad.AddCustom("RegionID", "IDQ10150")
        ' 51 is the badge no
        Dim notificationList = New List(Of NotificationPayload)() From { _
         payload _
        }

        Dim push = New PushNotification(True, "apn_developer_identity.p12", "password")
        Dim result = push.SendToApple(notificationList)
    Catch ex As Exception
        rt = "Error!"
    End Try

    Return rt

End Function

但在我的 iPhone 中没有收到口音。我收到了这个:Parab?ns ? 坎佩?o!

有人知道会发生什么?

问候

解决了!

我已更改为 PushNotification.cs 类中的库 Moon-APNS:

// String length
byte[] apnMessageLength = BitConverter.GetBytes((Int16)Encoding.UTF8.GetBytes(apnMessage).Length);

// Write the message
memoryStream.Write(Encoding.UTF8.GetBytes(apnMessage), 0, Encoding.UTF8.GetBytes(apnMessage).Length);

重新编译并使用到您的项目中。现在接受拉丁字符。

4

1 回答 1

1

您应该将有效负载编码为 UTF-8。

于 2013-03-11T18:16:17.100 回答