无法在Azure移动服务上向单个iOS用户发送推送通知

问题描述:

我已经在Azure上设置了移动服务,并上传了具有推送通知权限的开发证书.我正在使用mono touch从应用程序中获取设备令牌,并通过请求将其发送出去.插入项目后,我想向客户端发送推送,但是在日志中,我不断收到此错误

I've set up my mobile service on Azure and uploaded the development certificate with push notification permissions. I'm using mono touch to the get the device token from the app and sending that up with a request. When the item is inserted I want to send a push to the client but in the logs I keep getting this error

{ [Error: 400 - Invalid expression: '568d4f52 615ee9.......

其中表达式是我的设备令牌.如果转到表,我可以看到设备令牌与iOS应用程序中生成的令牌匹配.我确实将移动服务升级为增强的推送,但是找不到如何推送到单个用户的任何示例.在我的代码中,我有

where the expression is my device token. If I go to the table I can see that the device token matches the one generated in the iOS app. I did upgrade the mobile service to the enhanced push but can't find any examples of how to push to a single user. In my code I have

request.execute();
push.apns.send(item.pushNotificationHandle, {
                    alert : 'testing',
                    payload: { text1: 'inner text' } 
                }, {
                    error: function(error){
                        console.error(error);
                    }
                });

Azure网站上的文档似乎过时了,所以我不知道错误在哪里以及应该如何区别.在这里查看他们的服务器参考文档,我不确定为什么会失败

The docs on the Azure site seem to be getting pretty stale so I've no idea where the error is and how it should be different. Looking at their server reference docs here I'm not sure why this is failing

http://msdn.microsoft.com/en-US/library/azure/jj839711.aspx#send

有人对此有任何经验吗?我已经注销了"item.pushNotificationHandle",它是预期的字符串(表中的匹配项)

Does anyone have any experience with this? I have logged out "item.pushNotificationHandle" and it is a string as expected (matches in the table)

感谢您指出尚未更新的文档.

Thanks for pointing out the documentation which has not yet been updated.

请参阅此文档以获取push.apns的几乎准确的增强推送版本: http://dl.windowsazure.com/nodedocs/ApnsService.html

Please see this documentation for an almost accurate enhanced push version of push.apns: http://dl.windowsazure.com/nodedocs/ApnsService.html

您将看到send方法的第一个成员是标签.

What you can see is that the send method's first member is tags.

要使用增强的推送功能来定位单个用户,您应该为该用户添加其用户标签的唯一ID.然后,您将通知发送到该特定用户的标签. (此功能还可以用于发送给一部分用户.)

To use enhanced push to target a single user, you should add a unique id for that user the user's tags. Then you send the notification to that specific user's tag. (This feature can also be used for sending to a subset group of users.)