CoreData を利用しようとすると、エラー メッセージが表示され続けます (3 つすべてがコードの横にコメントとしてリストされているため、どこにあるかがわかります)。何らかの理由でこれらのエラーをオンラインで見つけることができません。私は CoreData に非常に慣れていないので、自分が間違っていることを見つけることに非常に興味があります。そして、誰かが疑問に思っている場合は、このスクリプトの以前のバージョンを持っていましたが、変更が多すぎました (データベースへの単純な追加に関する CoreData エラーを参照してください) 。
@synthesize username, password;
- (IBAction)saveData:(id)sender {
AppayAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
NSManagedObjectContext *context = [appDelegate managedObjectContext];
NSManagedObject *newContact; //Unknown type, did you mean NSManagedObjectModel?
newContact = [NSEntityDescription insertNewObjectForEntityForName:@"Contacts" inManagedObjectContext:context]; //Use of undeclared identifier NSEntityDescription. Did you mean kSecAttrDescription?
[newContact setValue:name.text forKey:@"name"];
[newContact setValue:address.text forKey:@"address"];
name.text = @"";
address.text = @"";
NSError *error;
[context save:&error]; //instance method -save not found
}