我只是 Mac OS X 编程的新手,所以请耐心等待。我正在尝试制作一个可可应用程序,其目标是从 Info.plist kext 的文件中读取一些信息,完整路径是/System/Library/Extensions/NVDAResman.kext/Contents/Info.plist
H。
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (weak) IBOutlet NSTextField *nvidiaNameTextField;
@end
米。
#import "AppDelegate.h"
@interface AppDelegate ()
@property (weak) IBOutlet NSWindow *window;
@end
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
[self setnvidiaNameTextField];
}
- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}
// This will allow the application to quit instead of just closing the window
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
{
return YES;
}
// Find NVIDIA Kernel Extension Name
-(void)setnvidiaNameTextField
{
NSString *nvidiaNameTextField = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
self.nvidiaNameTextField.stringValue = [NSString stringWithFormat:@"%@", nvidiaNameTextField];
}
@end
它可以工作,但与我的项目 Info.plist 文件一起使用,这不是我想要的。
所以我的问题是如何从 NVDAResman.kext 读取 Info.plist?
先感谢您
PS:我使用的是 Xcode 7.1 beta (7B60)