Can't send push notification to single iOS user on Azure Mobile Services

会有一股神秘感。 提交于 2019-12-12 12:18:19

问题


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.......

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);
                    }
                });

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

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


回答1:


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

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

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

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.)



来源:https://stackoverflow.com/questions/24174607/cant-send-push-notification-to-single-ios-user-on-azure-mobile-services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!