Table of Contents

drag and drop onto program icon

configure the target

establish an application delegate

In IB (Interface Builder) set a delegate for “File's Owner”, such as MyAppController

write the method to handle the drag and drop

Add this to the delegate of “File's Owner”

- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
	NSFileManager *fm = [NSFileManager defaultManager];
	if([fm isReadableFileAtPath:filename]){
		[self openLocation:filename];
		return YES;
	}
	return NO;
}

write the method to handle the file

- (void)openLocation:(NSString *)newLocation {

if([fileManager fileExistsAtPath:newLocation]){
	// do something
}

}