我使用的Windows Azure的iOS模板通過Azure的服務總線通知集線器IOS通知
服務總線通知集線器我用下面的代碼註冊設備:
SBNotificationHub* hub = [[SBNotificationHub alloc] initWithConnectionString:
@"Endpoint=sb://......" notificationHubPath:@"...."];
NSMutableSet *set = [NSMutableSet set];
[set addObject:@"general"];
[hub registerNativeWithDeviceToken:deviceToken tags:[set copy] completion:^(NSError* error) {
if (error != nil) {
NSLog(@"Error registering for notifications: %@", error);
[self.delegate homePopUpViewControllerEnterButtonPress:self];
}
}];
,並從淨後端發送通知通過使用下面的代碼:
var hubClient = NotificationHubClient.CreateClientFromConnectionString(<connection string>, "<notification hub name>");
IDictionary<string, string> properties = new Dictionary<string, string>();
properties.Add("badge", "1");
properties.Add("alert", "This is Test Text");
properties.Add("sound", "bingbong.aiff");
hubClient.SendTemplateNotification(properties, "general");
我能夠收到通知,但我的問題是:通知沒有,我補充說,沒有健全的任何財產,沒有徽章......
如果可以請幫我
引用:http://msdn.microsoft.com/en-US/library/jj927168.aspx
感謝
感謝埃利奧 運行這一行: hub.SendAppleNativeNotification(「{\」戒備\「:\」這是我的警告消息對於iOS!\「}」,「tag」); 我得到這個錯誤: 遠程服務器返回一個錯誤:(400)錯誤的請求。提供的通知負載無效.TrackingId:3d8e3198-223b-4245-ad2f-aebd4a59e4ae_G7,TimeStamp:2013年7月10日上午2:51:46 –
對不起,警報屬性必須位於https中所示的「aps」元素內://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html Eg {「aps」:{「alert」:「你好 !」}} –
偉大的埃利奧感謝;-) –