简体   繁体   中英

Azure Notification Hub doesn't work with enterprise release

When I run my application on my iPad from Xcode, everything works fine. But when I do enterprise release, push notification does not show up.

This is my code for registration:

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]) 
}

Code for catching the notification

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

Azure Portal Response

Azure 门户响应

Any opinions on what I am doing wrong?

You need to upload certificates for both Debug and Release mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM