Developer

Adding Custom Code

The Extensibility Framework does not impose any restrictions on developers: you can mix custom code with extensibility features.

Example

This example adds custom code that shows a UIAlertView once the extensibility engine is started:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    // Start the Extensibility engine; we pass in the UIWindow object, and that's it - no further data is needed to initialise and start the framework
	// Note that the API is executed asynchronously; once it completes, the completion block gets called, and we have to evaluate the error object: it should be nil, otherwise there were issues during initialization 
    [[MAFCore sharedInstance] loadWithWindow:self.window andCompletionBlock:^(NSError* error)
     {
         // Extensibility engine started successfully
         if( !error )
         {
             // Display an alert view
             [[[UIAlertView alloc] initWithTitle:@"Success!"
                                         message:@"Extensibility is Up and Running!"
                                        delegate:nil
                               cancelButtonTitle:@"Dismiss"
                               otherButtonTitles:nil, nil] show];

             NSLog( @"Extensibility is Up and Running!" );
             
         }
         // Extensibility engine failed to start!
         else
         {
             NSLog( @"Extensibility load failure. Details:%@", error.description );
         }
     }];
    // Can be safely removed, too, since the Extensibility framework will take care of displaying the root view controller
//    [self.window makeKeyAndVisible];
    return YES;
}