Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CHLibrarian/cf86a1e113d965c68bd4 to your computer and use it in GitHub Desktop.
Save CHLibrarian/cf86a1e113d965c68bd4 to your computer and use it in GitHub Desktop.
Application Services Device Retrieve by ID (iOS)
NSString *deviceToRetrieveID = @"76BC4719-6344-4E62-8FA2-F00A8D29B60E";
// Retrieve device from ContextHub
[[CCHDevice sharedInstance] getDeviceWithId:deviceToRetrieveID completionHandler:^(NSDictionary *device, NSError *error)completionHandler {
if (!error) {
NSString *deviceID = device[@"id"];
NSString *deviceType = device[@"device_type"];
// Not present if not previously set
NSString *deviceAlias = device[@"alias"];
NSArray *deviceTags = device[@"tags"];
NSString *tagString = device[@"tag_string"];
// Not present if push not configured
NSString *pushToken = device[@"push_token"];
// Not always present
NSDictionary *lastProfile = device[@"last_profile"];
NSDictionary *additional_info = device[@"additional_info"];
} else {
NSLog(@"Error retrieving device from ContextHub);
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment