|
From: | Edwin Ancaer |
Subject: | Re: GDL2 problem |
Date: | Sat, 13 Jun 2015 11:37:52 +0200 |
I created an application , and tried to integrate some code I found inThe code (sloppy, with unused variables) in ApplicationDidFinishLaiunching looks as follows:
- (void) applicationDidFinishLaunching: (NSNotification *)aNotif
{
// Uncomment if your application is Renaissance-based
// [NSBundle loadGSMarkupNamed: @"Main" owner: self];
EODatabaseContext *aDatabaseContext;
EOModelGroup *aModelGroup;
EODatabase *aDatabase;
EOModel *aModel;
EOAdaptor *adaptor;
EOAdaptorContext *context;
EOAdaptorChannel *channel;
EOEditingContext *ec;
EODatabaseDataSource *authorsDS;
EODataSource *booksDS;
id author;
id book;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
aModelGroup = [EOModelGroup globalModelGroup];
aModel = [aModelGroup modelNamed:@"MultiDB"];
NSLog(@"model initialized? %@", aModel);
adaptor = [EOAdaptor adaptorWithModel:aModel];
NSLog(@"adaptor initialized? %@", adaptor);
NSLog(@"model in adaptor? %@", [adaptor model]);
context = [adaptor createAdaptorContext];
NSLog(@"context initialized? %@", context);
channel = [context createAdaptorChannel];
NSLog(@"channel initialized? %@", channel);
ec = [[EOEditingContext alloc] init];
NSLog(@"editing context initialized? %@", ec);
authorsDS = [[EODatabaseDataSource alloc] initWithEditingContext: ec entityName:@"Persons"];
NSLog(@"data source initialized? %@", authorsDS);
[pool release];
}This is the end of the NSLOG output:
2015-06-13 09:49:22.758 Crud[10089:10089] editing context initialized? <EOEditingContext: 0x8c8a6b8>
2015-06-13 09:49:22.759 Crud[10089:10089] Problem posting notification: <NSException: 0x8c9da60> NAME:NSInvalidArgumentException REASON:adaptorWithModel: -- EOAdaptor 0xb695c9f0: no model specified INFO:(null)I suspect the error is at initializing the variable AuthorsDS, (the complete output is in the attached file).What I don't get is how authorsDS is linked to the prevously created model aModel since I just did alloc - init for the editingcontext.
In that sense it seems logic that no model is found and an error occurs.Can someone help with this?
[Prev in Thread] | Current Thread | [Next in Thread] |