【发布时间】:2017-11-11 04:23:18
【问题描述】:
Azure 通知中心未注册到服务器。我没有更改将设备注册到服务器的代码中的任何内容。以前它工作得很好,但现在不行。
运行此代码时遇到此问题:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
SBNotificationHub* hub = [[SBNotificationHub alloc] initWithConnectionString:HUBFULLACCESS notificationHubPath:HUBNAME];
[hub unregisterAllWithDeviceToken:deviceToken completion:^(NSError* error){
dispatch_async(dispatch_get_main_queue(), ^{
[hub registerNativeWithDeviceToken:deviceToken tags:tags completion:^(NSError* error) {
if (error != nil) {
NSLog(@"Error registering for notifications: %@", error);
} else {
NSLog(@"Registerd for notification");
}
}];
});
}];
});
这是错误:
Error Domain=WindowsAzureMessaging Code=400 "对于 { URL: https://.servicebus.windows.net//Registrations/2044525541292942848-4457854038111768645-1?api-version=2013-04 } 的 URLRequest 失败,状态码:bad请求” UserInfo={NSLocalizedDescription=URLRequest 失败 { URL: https://.servicebus.windows.net//Registrations/2044525541292942848-4457854038111768645-1?api-version=2013-04 } 状态码:错误请求}
我检查了所有证书和配置文件,一切都很好。
【问题讨论】:
-
你检查request headers了吗?你试过
api-version=2015-01吗?你试过registrations小写吗?
标签: ios push-notification azure-notificationhub