2010-06-28 4 views

Répondre

0

En regardant le code de FScript.app, qui est rapporté être lié à la plupart du cadre de base, je trouve la méthode suivante:

- (void)loadSystemFrameworks // Contributed by Cedric Luthi 
{ 
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 

    NSMutableArray *systemFrameworksPaths = [NSMutableArray arrayWithObject:@"/System/Library/Frameworks"]; 

    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"FScriptLoadPrivateSystemFrameworks"]) 
    [systemFrameworksPaths addObject:@"/System/Library/PrivateFrameworks"]; 

    for (NSString *systemFrameworksPath in systemFrameworksPaths) 
    { 
    for (NSString *framework in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:systemFrameworksPath error:NULL]) 
    { 
     NSBundle *frameworkBundle = [NSBundle bundleWithPath:[systemFrameworksPath stringByAppendingPathComponent:framework]]; 
     if ([frameworkBundle preflightAndReturnError:nil]) 
     [frameworkBundle load]; 
    } 
    } 

    [pool drain]; 
} 

Je prends que pour les lier aux classes définies à partir d'un application est suffisante pour charger le bundle contenant les classes.

Questions connexes