【发布时间】:2010-06-28 23:43:56
【问题描述】:
【问题讨论】:
标签: objective-c osx-snow-leopard f-script
【问题讨论】:
标签: objective-c osx-snow-leopard f-script
查看FScript.app的代码,据说链接了大部分Core框架,发现如下方法:
- (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];
}
我认为链接到从应用程序定义的类足以加载包含这些类的包。
【讨论】: