Framework Busy States

The Extensibility Framework internally fetches and converts data based on the data bindings defined in the configuration.

Set up a subscription to be notified about the execution of these time-consuming tasks, so that you can, in turn, notify the device user, or intercept any issues occurring during data fetching and processing. The framework communicates with the app’s delegate by invoking the delegate methods defined by the MAFExtLoadingDelegate.

For example, in the online OData scenario when the service document and the metadata fetch is started, the framework invokes the mafExtLoadingStartedForBindingDescriptor delegate method, if it is implemented by the app delegate. At this point, you can show a progress bar or an alert view to notify the user that something is happening. Once the loading process completes, the mafExtLoadingFinished delegate is called; you can dismiss the alert view here.

Applications must also handle loading process failures. In such cases, the mafExtLoadingFailedWithError: delegate method is called, which lets you handle the error and notify the device user about the issue. The supplied NSError object contains problem details; use this objectfor debugging, logging, and tracing.

This example demonstrates how to handle the framework busy state: it shows an alert view while the framework is busy, which is then dismissed in the delegate method invoked by the framework when all tasks have completed.

#pragma mark MAFExtLoadingDelegate methods

- (void) mafExtLoadingStartedForBindingDescriptor :(MAFBindingDescriptorBase*)bindingDescriptor_in
{    
    self.alertView = [[[UIAlertView alloc]initWithTitle:@"Loading..." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:nil] autorelease];
    [self.alertView show];
}

- (void)mafExtLoadingFinished 
{
    [self.alertView dismissWithClickedButtonIndex:0 animated:YES];
    self.alertView = nil;
}

- (void)mafExtLoadingFailedWithError:(NSError *)error_in 
{
    //dismiss loading alertView
    [self.alertView dismissWithClickedButtonIndex:0 animated:YES];
    self.alertView = nil;
    
    NSLog(@"Reason: %@", [error_in description]);
}