Registering an Application

Each device must register with the server before establishing a connection.

To register the device with the server during the initial application startup, use the registerApplication method in the SUPApplication class. You do not need to use the registerApplication method for subsequent application startups.To start the connection to complete the registration process, use the Application.startConnection method.

Call the generated database's setApplication method before starting the connection or registering the device.

The following code shows how to register the application and device.
SUPApplication* app = [SUPApplication getInstance];
@try {
  [app setApplicationIdentifier: @"appname"]; ( same as in SCC )
  [app setApplicationCallback:self];
  SUPConnectionProperties* props = app.connectionProperties;
  [props setServerName:@"servername"];
  [props setPortNumber:portnumber];
  [props setUrlSuffix:@""];
  [props setFarmId:@"1"]; ( same as in SCC )
  SUPLoginCredentials* login = [SUPLoginCredentials getInstance];
  login.username = @"username"; ( same as in SCC )
  login.password = nil;
  props.loginCredentials = login;
  props.activationCode = @"activationcode"; ( same as in SCC ) 
}
@catch (SUPPersistenceException * pe) {
  NSLog(@"%@: %@", [pe name],[pe message]);
}

// Initialize generated package database class with this Application instance
[SUP101SUP101DB setApplication:app];

@try {
  [app registerApplication:0]
}
@catch (SUPApplicationTimeoutException * pe) {
  NSLog(@"%@: %@", [pe name],[pe message]);
}
Related reference
Application APIs