BuiltInstallation Class Reference

Inherits from BuiltObject : NSObject
Declared in BuiltInstallation.h

Other Methods

  deviceToken

APNS device token

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication installation];
 NSString *deviceToken = installation.deviceToken;

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.installation()
 var deviceToken:String = installation.deviceToken
@property (nonatomic, copy) NSString *deviceToken

Discussion

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

  channels

subscription channels

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication installation];

 //setting channels
 installation.channels = @[@"project.object.create", @"project.object.update"];

 //getting channels
 NSArray *channelsArray = installation.channels;

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.installation()

 //setting channels
 installation.channels = ["project.object.create", "project.object.update"]

 //getting channels
 var channelsArray:AnyObject! = installation.channels
@property (nonatomic, copy) NSArray *channels

Discussion

You can use the following as channel names:

{class_uid}.object.create

Use this activity channel, when you want to send notification, after any object is created inside the class with the uid class_uid

{class_uid}.object.update

Use this activity channel, when you want to send notification, after any object is updated inside the class with the uid class_uid

{class_uid}.object.delete

Use this activity channel, when you want to send notification, after any object is deleted inside the class with the uid class_uid

{class_uid}.{object_uid}.update

Use this activity channel, when you want to send notification, after an object with the uid object_uid is updated inside the class with the uid class_uid

{class_uid}.{object_uid}.delete

Use this activity channel, when you want to send notification, after an object with the uid object_uid is deleted inside the class with the uid class_uid

upload.create

Use this activity channel, when you want to send a notification after an upload is created.

{upload_uid}.update

Use this activity channel, when you want to send a notification after an upload is updated.

{upload_uid}.delete

Use this activity channel, when you want to send a notification after an upload is deleted.

upload.update

Use this activity channel, when you want to send a notification after any upload is updated.

upload.delete

Use this activity channel, when you want to send a notification after any upload is deleted.

Developer-Defined Channels

These are the custom-channel names that the application developer can use subscribe/unsubscribe the installations to. This can be any random name. You can directly subscribe the installation to a channel, it is not required to create a channel first and then make the installation subscribe to it

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

  timezone

time zone of the installation

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication installation];
 NSTimeZone *timeZome = installation.timezone;

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.installation()
 var timeZone:TimeZone = installation.timezone
@property (nonatomic, strong) NSTimeZone *timezone

Discussion

sets a time zone to the ionstalltion object. Default is the current system time zone.

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

  geoLocation

location for an installation

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication installation];
 BuiltLocation *builtLocation = installation.geoLocation;

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.installation()
 var builtLocation:BuiltLocation =  installation.geoLocation
@property (nonatomic, strong) BuiltLocation *geoLocation

Discussion

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

  credentialsName

Credentials name for an installation. Default value is “default”

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication installation];
 NSString *credentilasName = installation.credentialsName;

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.installation()
 var credentialsName:String =  installation.credentialsName
@property (nonatomic, strong) NSString *credentialsName

Discussion

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

Headers

– setHeader:forKey:

Set a header for an application

- (void)setHeader:(NSString *)headerValue forKey:(NSString *)headerKey

Parameters

headerValue

The header key

headerKey

The header value

Discussion

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication installation];
 [installation setHeader:@"MyHeaderValue" forKey:@"My-Custom-Header-Key"];

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.installation()
 installation.setHeader("MyHeaderValue", forKey:"My-Custom-Header-Key")

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

– addHeadersWithDictionary:

Set a header for an application

- (void)addHeadersWithDictionary:(NSDictionary *)headers

Parameters

headers

The headers as dictionary which needs to be added to the application

Discussion

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication installation];
 [installation addHeadersWithDictionary:@{@"My-Custom-Header": @"MyValue"}]

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.installation()
 installation.addHeadersWithDictionary(["My-Custom-Header":"MyValue"])

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

– removeHeaderForKey:

Removes a header from this application.

- (void)removeHeaderForKey:(NSString *)headerKey

Parameters

headerKey

The header key that needs to be removed

Discussion

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication installation];
 [installation removeHeaderForKey:@"My-Custom-Header"]

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.installation()
 installation.removeHeaderForKey("My-Custom-Header")

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

Clear/Disable Installation

– clearInstallation

Clear installation data on disk

- (void)clearInstallation

Discussion

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication currentInstallation];
 [installation clearInstallation];

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.currentInstallation()
 installation.clearInstallation()

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

– disableInstallation:

Disable installation

- (void)disableInstallation:(BOOL)shouldDisable

Discussion

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication currentInstallation];
 [installation disableInstallation:YES];

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.currentInstallation()
 installation.disableInstallation(true)

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

Clear Badge

– clearBadge

Clear the badge count

- (void)clearBadge

Discussion

This method notifies Built.io Backend to set the notification badge count to zero.

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication installation];
 [installation clearBadge];

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.installation()
 installation.clearBadge()

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

Create/Update Installation

– createInstallationWithSubscriptionChannels:completion:

Asynchronously create a new installation

//'blt5d4sample2633b' is a dummy Application API key

//Obj-C
BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
BuiltInstallation *installation = [builtApplication installation];
NSError *error;
NSArray subscriptionChannels = @[@"object.create", @"object.delete"];
[installation createInstallationWithSubscriptionChannels:subscriptionChannels completion:^(BuiltResponseType responseType, NSError *error) {

}];

//Swift
var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
var installation:BuiltInstallation = builtApplication.installation()
var subscriptionChannels = ["object.create", "object.delete"]
installation.createInstallationWithSubscriptionChannels(subscriptionChannels) { (responseType, error!) -> Void in

}
- (void)createInstallationWithSubscriptionChannels:(NSArray *)channels completion:(BuiltRequestCompletionHandler)completionBlock

Parameters

channels

Array of channel we wish to subscribe to.

completionBlock

Completion block with params (BuiltResponseType responseType, id responseJSON, NSError *error)

Discussion

Create a new installation with the device token.

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

– updateInstallation:

Asynchronously update the current installation with the logged in user, location and time zone.

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication installation];
 [installation updateInstallation:^(BuiltResponseType responseType, NSError *error) {

 }];

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.installation()
 installation.updateInstallation { (responseType, error!) -> Void in

 }
- (void)updateInstallation:(BuiltRequestCompletionHandler)completionBlock

Parameters

completionBlock

Completion block with params (BuiltResponseType responseType, id responseJSON, NSError *error)

Discussion

this method associates the installation with the user and updates the location and timezone if set. Call this method after the user is logged in if user is to be associated with the installation.

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

Subscribe/Unsubscribe to Channels

– subscribeToChannels:completion:

Asynchronously subscribe an installation to more channels.

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication installation];
 NSArray subscriptionChannels = @[@"Sports",@"Technology"];

 [installation  subscribeToChannels:subscriptionChannels completion:^(BuiltResponseType responseType, NSError *error) {

 }];

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.installation()
 var subscriptionChannels = ["Sports", "Technology"]
 installation.subscribeToChannels(subscriptionChannels) { (responseType, error!) -> Void in

 }
- (void)subscribeToChannels:(NSArray *)channels completion:(BuiltRequestCompletionHandler)completionBlock

Parameters

channels

Array of channel we wish to subscribe to.

completionBlock

Completion block with params (BuiltResponseType responseType, id responseJSON, NSError *error)

Discussion

Using this method you can add more channels to your subscription list.

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h

– unsubscribeToChannels:completion:

Asynchronously unsubscribe an installation from channels

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltInstallation *installation = [builtApplication installation];
 NSArray unsubscriptionChannels = @[@"Sports", @"Technology"];
 [installation  unsubscribeToChannels:unsubscriptionChannels completion:^(BuiltResponseType responseType, NSError *error) {

 }];

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var installation:BuiltInstallation = builtApplication.installation()
 var unsubscriptionChannels = ["Sports", "Technology"]
 installation.unsubscribeToChannels(unsubscriptionChannels) { (responseType, error!) -> Void in

 }
- (void)unsubscribeToChannels:(NSArray *)channels completion:(BuiltRequestCompletionHandler)completionBlock

Parameters

channels

Array of channel we wish to unsubscribe to.

completionBlock

Completion block with params (BuiltResponseType responseType, id responseJSON, NSError *error)

Discussion

Using this method you can unsubscribe from channels.

Warning: Not supported in watchOS

Declared In

BuiltInstallation.h