【问题标题】:Windows Azure iOS Push Notifications ErrorWindows Azure iOS 推送通知错误
【发布时间】: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:] 看看是否有效?这将有助于将问题缩小到参数/客户端与通知中心。
  • 你的问题解决了吗!?我遇到了同样的错误

标签: ios azure-mobile-services


【解决方案1】:

确保您拥有最新的 WindowsAzureMessaging.Framework(可在此处获得:https://go.microsoft.com/fwLink/p/?LinkID=266533),然后尝试将您的代码更改为:

SBNotificationHub *hub = [[SBNotificationHub alloc] initWithConnectionString:
                @"NotificationHubListenSharedAccessSignature"
                notificationHubPath:@"NotificationHubName"];

将这两个参数替换为您的 Hub 的值。请确保 HubName 只是您的通知中心的名称,而不是您的服务总线命名空间。

【讨论】:

  • 不幸的是,仍然遇到与上述相同的错误。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-03-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-06
相关资源
最近更新 更多