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 start-ups. The registerApplication method automatically starts the connection to complete the registration process.

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]; ( must implement the SUPApplicationCallback protocol ) 
  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
[SMP101SMP101DB setApplication:app];

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