0
這裏是我的代碼:編輯外部屬性格式列表(的.plist)
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
}
- (IBAction)unlockIt:(id)sender {
if ([[appField stringValue] length] < 1) {
[status setTextColor:[NSColor redColor]];
[status setStringValue:@"error with name"];
}
else {
[status setStringValue:@""];
[status setTextColor:[NSColor greenColor]];
NSString *path = [NSString stringWithFormat:@"/Applications/%@.app/Contents", [appField stringValue]];
NSBundle *bundle = [NSBundle bundleWithPath:path];
NSString *infoPlist = [bundle pathForResource:@"Info" ofType:@"plist"];
NSString *randomIdentifier = [NSString stringWithFormat:@"com.derp.%i", arc4random()];
[infoPlist setValue:randomIdentifier forKey:@"Bundle identifier"];
[status setStringValue:@"attempt successful"];
}
}
我得到這個錯誤:
[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Bundle identifier.
我該如何解決這個問題?
我仍然得到'的setValue:forUndefinedKey:]:此類不是密鑰值編碼兼容的關鍵CFBundleIdentifier.' ... – Sam
哦,謝謝!現在正在工作。 :) – Sam