【发布时间】:2014-10-14 09:45:17
【问题描述】:
我正在尝试使用 Windows Azure 向 iOS、Android 等推送通知。
在 iOS 上,我有以下代码创建并注册到 Windows Azure。
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *) deviceToken {
NSString * connectionString =
[SBConnectionString stringWithEndpoint: [NSURL URLWithString: @"https://AA-ns.servicebus.windows.net/"] listenAccessSecret:@"BBBBB"];
SBNotificationHub*hub = [[SBNotificationHub alloc] initWithConnectionString: connectionString notificationHubPath:@"AA"];
[hub registerNativeWithDeviceToken:deviceToken tags:nil completion:^(NSError* error) {
if (error != nil) {
NSLog(@"Error registering for notifications: %@", error);
}
else {
NSLog(@"Register successful");
}
}];
}
当我在我的设备上运行时,我收到以下错误,不确定是什么原因造成的:
注册通知时出错:错误 Domain=WindowsAzureMessaging Code=-1 "发起请求失败 {网址: https://AA-ns.servicebus.windows.net/BB/Registrations/2131816658076175975-431628186293699175-5?api-version=2013-04, 标题:{ 授权=“SharedAccessSignature SR = HTTP%3A%2F%AA-ns.servicebus.windows.net%AA%2fregistrations%2f2131816658076175975-431628186293699175-5%3fapi版本%3d2013-04&SIG = yW6mDy6RbpgWHi9NINUv2zZ4cbaI6tcC91nGlg%2FjT%2B4%3D&SE = 1413280889&SKN = DefaultListenSharedAccessSignature"; “内容类型”=“应用程序/xml”; "用户代理" = "NOTIFICATIONHUBS/2013-04(api-origin=IosSdk; os=iPhone OS; os_version=8.0.2;)"; } }" 用户信息=0x16014600 {NSLocalizedDescription=发起请求失败 {网址: https://AA-ns.servicebus.windows.net/BB/Registrations/2131816658076175975-431628186293699175-5?api-version=2013-04, 标题:{ 授权=“SharedAccessSignature SR = HTTP%3A%2F%AA-ns.servicebus.windows.net%AA%2fregistrations%2f2131816658076175975-431628186293699175-5%3fapi版本%3d2013-04&SIG = yW6mDy6RbpgWHi9NINUv2zZ4cbaI6tcC91nGlg%2FjT%2B4%3D&SE = 1413280889&SKN = DefaultListenSharedAccessSignature"; “内容类型”=“应用程序/xml”; "用户代理" = "NOTIFICATIONHUBS/2013-04(api-origin=IosSdk; os=iPhone OS; os_version=8.0.2;)"; } }}
(我删除了对我的应用程序名称的引用)
请帮忙。谢谢
【问题讨论】:
-
如果您也在使用移动服务,您可以尝试使用 [client.push registerNativeWithDeviceToken: tags: completion:] 看看是否有效?这将有助于将问题缩小到参数/客户端与通知中心。
-
你的问题解决了吗!?我遇到了同样的错误