Built Class Reference

Inherits from NSObject
Declared in Built.h

Overview

The Built module acts as the entry point for the SDK.

Initializing App

+ applicationWithAPIKey:

Represents an application

+ (BuiltApplication *)applicationWithAPIKey:(NSString *)apiKey

Parameters

apiKey

Your application api-key to uniquely identify the app

Return Value

New instance of application object for provided api-key

Discussion

//'blt5d4sample2633b' is a dummy Application API key

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

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

Declared In

Built.h

+ applicationWithAPIKey:withConfig:

Represents an application

+ (BuiltApplication *)applicationWithAPIKey:(NSString *)apiKey withConfig:(BuiltConfig *)config

Parameters

apiKey

Your application api-key to uniquely identify the app.

config

BuiltConfig to initalize application.

Return Value

New instance of application object for provided api-key and config

Discussion

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltConfig *config = [[BuiltConfig alloc] init];
 config.host = @"api.built.io";
 config.isSSL = YES;
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b" withConfig:config];

 //Swift
 var config:BuiltConfig = BuiltConfig()
 config.host = "api.built.io"
 config.isSSL = true
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b" withConfig:config)

Declared In

Built.h

Reachability

+ reachabilityStatusChangeHandler:

Reachability change helper to notify whenever internet connection is connected or disconnected.

+ (void)reachabilityStatusChangeHandler:(BuiltRechabilityChangeHandler)changeHandler

Parameters

changeBlock

invoked when network rechability has changed

Discussion

Below is the example of using this method.

 //Obj-C
 [Built reachabilityStatusChangeHandler:^(BuiltReachabilityStatus status) {
     if (status == BuiltReachabilityStatusNotReachable) {
     // No Internet connection
     }else  if (status == BuiltReachabilityStatusReachableViaWiFi) {
     // Reachable via Wifi
     }else  if (status == BuiltReachabilityStatusReachableViaWWAN) {
     // Reachable via 2G/3G/Cellular network
     }
 }]

//Swift
 Built.reachabilityStatusChangeHandler { (status) -> Void in
     if (status == BuiltReachabilityStatus.NotReachable){
     // No Internet Connection
     }else if (status == BuiltReachabilityStatus.ReachableViaWiFi){
     // Reachable via Wifi
     }else if (status == BuiltReachabilityStatus.ReachableViaWWAN){
     // Reachable via 2G/3G/Cellular network
     }
 }

Warning: Not supported in watchOS

Declared In

Built.h

Cancel All Network Calls

+ cancelAllRequestsOfApplication:

Cancels all queued and executing operations of an application except realtime

+ (void)cancelAllRequestsOfApplication:(BuiltApplication *)application

Parameters

application

BuiltApplication instance object of which all network operation needs to be cancel.

Discussion

Below is the example of using this method.

 //Obj-C
 [Built cancelAllRequestsOfApplication:builtApplication];

 //Swift
 Built.cancelAllRequestsOfApplication(builtApplication)

Declared In

Built.h