簡體   English   中英

Azure 通知中心不適用於企業版

[英]Azure Notification Hub doesn't work with enterprise release

當我從 Xcode 在我的 iPad 上運行我的應用程序時,一切正常。 但是當我做企業發布時,推送通知沒有出現。

這是我的注冊代碼:

func registerForAzurePushNotifications() {
    let connectionString = "Endpoint=sb://xyz="
    let hubName = "POC"

    // Creates with alert, badge and sound
    let hubOptions = MSNotificationHubOptions(withOptions: [.alert, .badge, .sound])
    // Starts MSNotificationHub SDK
    MSNotificationHub.start(connectionString: connectionString, hubName: hubName, options: hubOptions!)
    // Get the Device identifier
    var deviceTag = ""
    // Creates tags with type_value format
    if let id = UIDevice.current.identifierForVendor?.uuidString{
       deviceTag = id
    }
    MSNotificationHub.addTags([deviceTag]) 
}

捕捉通知的代碼

func notificationHub(_ notificationHub: MSNotificationHub, didReceivePushNotification notification: MSNotificationHubMessage) {
    let title = notification.title ?? ""
    let body = notification.body ?? ""
    print("Notification received: title:\"\(title)\" body:\"\(body)\"")
}

Azure 門戶響應

Azure 門戶響應

對我做錯了什么有意見嗎?

您需要為 Debug 和 Release 模式上傳證書。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM