Code when the app is launched

Discussion in 'Mac Programming' started by Blakeasd, Jul 18, 2010.

  1. Blakeasd macrumors 6502a

    Joined:
    Dec 29, 2009
    #1
    I have this program that checks if Chrome is installed on your computer. If it is not installed it will make a button on the main interface not visible. Where do I put the method that does this so it is triggered on startup? Here is my code:
    Code:
    -(IBAction)doesChromeExist:(id)sender{
    	NSString *chromePathName = [@"/Users/" stringByAppendingString:NSUserName()];
    	chromePathName = [chromePathName stringByAppendingString:@"/Applications/Chrome.app"];
    	NSFileManager *manager;
    	manager = [NSFileManager defaultManager];
    	if([manager fileExistsAtPath:chromePathName]==YES){
    		[clearChromeCache setTransparent:TRUE];	}
    
    }
    
    Thanks in advance!
     
  2. Blakeasd thread starter macrumors 6502a

    Joined:
    Dec 29, 2009
    #3
    Before my program even shows the main window, I want this code to be run:
    Code:
    -(IBAction)doesChromeExist:(id)sender{
    	NSString *chromePathName = [@"/Users/" stringByAppendingString:NSUserName()];
    	chromePathName = [chromePathName stringByAppendingString:@"/Applications/Chrome.app"];
    	NSFileManager *manager;
    	manager = [NSFileManager defaultManager];
    	if([manager fileExistsAtPath:chromePathName]==YES){
    		[clearChromeCache setTransparent:TRUE];	}
    
    }
    
    How do I achieve this?
     

Share This Page