Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
- //create the template
- NSString *templateName = @"alertTemplate";
- NSString *template = @"{\"aps\": {\"alert\": \"$(alert)\"}}";
- //create my specific tags that I want to receive
- NSMutableSet *setTags = [NSMutableSet set];
- [setTags addObject:[NSString stringWithFormat:@"user_id:%lld", userId]];
- //register this device
- hub = [[SBNotificationHub alloc] initWithConnectionString:azureNotificationHubListen notificationHubPath:azureNotificationHubPath];
- [hub registerTemplateWithDeviceToken:deviceToken name:templateName jsonBodyTemplate:template expiryTemplate:@"0" tags:setTags completion:^(NSError *error) {
- if (error) {
- NSLog(@"Error registering for notifications with Azure: %@", [error localizedDescription]);
- } else {
- NSLog(@"Registered to receive notifications with tag: %@", [setTags allObjects]);
- }
- }];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement