Configuring the SUP101Appdelegate Files

The SUP101Appdelegate.h and SUP101Appdelegate.m files are created when you create the Xcode project; however, you deleted the automatically generated versions and replaced them with the ones added from the source code zip file.

Delegates extend the functionality of reusable objects. A delegate allows one object to send messages to another object specified as its delegate to ask for input, or to be notified when an event occurs.

The applicationDidFinishLaunching method contains code needed to start the application, register for notifications, and start up the messaging layer to begin communications with the server. The onConnectSuccess and onConnectFailure methods are notification handlers. When the the messaging layer calls the callback handler's onConnectionStatusChange method, indicating that communications are established, the ON_CONNECT_SUCCESS notification is sent. When it gets this notification, the app delegate runs onConnectSuccess to begin the login process. If communication cannot be established, onConnectionFailure runs.

  1. View the SUP101Appdelegate.h file.
  2. View the SUP101Appdelegate.m file and update the Sybase Unwired Platform administration credentials.
    Replace the bolded text with the administration credentials you indicated during installation.
    -(void)onConnectSuccess:(NSNotification *)obj
    {
        // Connection to the server was made, so log in.
        // See [CallbackHandler onLoginSuccess] and [CallbackHandler onLoginFailure]. One of those
        // callbacks will be called at some point in the future.
        [[NSNotificationCenter defaultCenter] removeObserver:self name:ON_CONNECT_SUCCESS object:nil];
        [[NSNotificationCenter defaultCenter] removeObserver:self name:ON_CONNECT_FAILURE object:nil];
        [SUP101_SUP101DB beginOnlineLogin:@"supAdmin" password:@"s3pAdmin"];
    }