 iOS Tutorial Part I
                        iOS Tutorial Part I
                    
                For the purposes of the Tutorial, we will instantiate the FatFractal class as a singleton to the AppDelegate class. To your AppDelegate.h file, add:
#import <FFEF/FatFractal.h>add the methods:
+ (FatFractal *) ff;Then, in your AppDelegate.m file, add:
static FatFractal *_ff;and the implementation:
+ (FatFractal *) ff {
    return _ff;
}
                    Also add the following code to your app delegate's applicationDidFinishLaunching:withOptions: method:
                
_ff = [[FatFractal alloc] initWithBaseUrl:@"http://acme.fatfractal.com/hoodyoodoo"
sslUrl:@"https://acme.fatfractal.com/hoodyoodoo"];
_ff.debug = YES;We also need to put in some code for logging in to NoServer APIs. We'll create a utility method for showing a login alert. Add the following instance variables and declaration to AppDelegate.h:
@interface AppDelegate : UIResponder  {
    id _sender;
    SEL _action;
}
- (void)showLoginWithDelegate:(id)sender action:(SEL)action message:(NSString *)message; And the following to AppDelegate.m:
- (void)showLoginWithDelegate:(id)sender action:(SEL)action message:(NSString *)message {
    UIAlertView *prompt = [[UIAlertView alloc] initWithTitle:@"Login/ Register"
    message:message
    delegate:self
    cancelButtonTitle:@"Cancel"
    otherButtonTitles:@"Enter", nil];
    [prompt setAlertViewStyle:UIAlertViewStyleLoginAndPasswordInput];
    _action = action;
    _sender = sender;
    [prompt show];
}
- (void)alertView:(UIAlertView *)prompt clickedButtonAtIndex:(NSInteger)buttonIndex {
    [self resignFirstResponder];
    if(buttonIndex == 0) {
        return;
    } else {
        NSError *error;
        [_ff loginWithUserName:[[prompt textFieldAtIndex:0] text] 
                   andPassword:[[prompt textFieldAtIndex:1] text] 
                         error:&error];
        NSLog(@"AppDelegate alertView clickedButtonAtIndex: username: %@", 
            [prompt textFieldAtIndex:0]);
        NSLog(@"AppDelegate alertView clickedButtonAtIndex: password: %@", 
            [prompt textFieldAtIndex:1]);
        if (error) {
            [self showLoginWithDelegate:_sender action:_action
            message:@"Please Login"];
        } else {
            if([_sender respondsToSelector:_action]) {
                [_sender performSelector:_action];
            } else
            NSLog(@"Callback function cannot be found");
        }
    }
}NEXT: Add the Celebrity UI