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 门户响应
对我做错了什么有意见吗?
您需要为调试和发布模式上传证书。
当我从 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 门户响应
对我做错了什么有意见吗?
您需要为调试和发布模式上传证书。