Set Application Tag

tag is used to label users with different elements of the app's business logic. 
For example, if your app is intended for pet owners, you can define the different pets as tags ("Dog", "Cat", “Parrot” etc.) and then label users with different tags, depending on the pets they own. 
Tags are a useful way to create Segments: Groups of devices that share the same parameters (in this case, the tag values). 
You can then send Push notifications to the relevant segments (for example, one notification for dog owners and another for cat owners). 

 

 

[[Appoxee shared] removeTagsFromDevice:@[@"tag1", @"tag2"] withCompletionHandler:^(NSError *appoxeeError, id data) { if (appoxeeError) { // check the error domain } }]; [[Appoxee shared] addTagsToDevice:@[@"tag1", @"tag2"] andRemove:@[@"tagToRemove1", @"tagToRemove2"] withCompletionHandler:^(NSError *appoxeeError, id data) { if (appoxeeError) { // check the error domain } }]; [[Appoxee shared] clearTagsCacheWithCompletionhandler:^(NSError *appoxeeError, id data) { if (!appoxeeError) { // operation is successful } }]; [[Appoxee shared] removeTagsFromDevice:@[@"tagToRemove1", @"tagToRemove2"] withCompletionHandler:^(NSError *appoxeeError, id data) { if (appoxeeError) { // check the error domain } }]; [[Appoxee shared] fetchApplicationTags:^(NSError *appoxeeError, id data) { if (!appoxeeError && [data isKindOfClass:[NSArray class]]) { NSArray *applicationTags = (NSArray *)data; } }];

 

Appoxee.shared()?.addTags(toDevice: ["tag1", "tag2"], withCompletionHandler: { (error, data) in if (error != nil) { //Tag successfully added. } }) Appoxee.shared()?.addTags(toDevice: ["tag1", "tag2"], andRemove: ["tagToRemove1", "TagToRemove2"], withCompletionHandler: { (error, data) in if (error != nil) { //Tag successfully added and tags marked for removial are successfuly removed. } }) Appoxee.shared()?.clearTagsCache(completionhandler: { (error, data) in if (error != nil) { //Tags cache cleared successfully. } }) Appoxee.shared()?.removeTags(fromDevice: ["tagToRemove1", "tagToRemove2"], withCompletionHandler: { (error, data) in if (error != nil) { //Tag successfully removed. } }) Appoxee.shared()?.fetchDeviceTags({ (error, data) in let tags = data as? NSMutableArray if (error != nil && tags != nil) { //Tags successfully fetched. } })

 

//Add a tag to device public RequestStatus addTag(String tag) //use this syntax to add tag Appoxee.instance().addTag(tag); //Get all tags apply to the device public Set<String> getTags() //use this syntax for getting all tags Appoxee.instance().getTags() //Remove tag for device, pass tag into parameter, which you want to remove public RequestStatus removeTag(String tag){ //use this syntax for removing tag Appoxee.instance().removeTag(removeTag)