objective c - iOS CGRectOffset and Core Data Issues -


i know doesn't make sense, i'm getting strange error in iphone app building using core data , calling cgrectoffset. app delegate's didfinishlaunchingwithoptions method looks this:

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {      // setup managed object context nsmanagedobjectcontext *context = [self managedobjectcontext]; if (!context) {     // - exit }  //load database form plist nsstring *plistpath = [[nsbundle mainbundle] pathforresource:@"tjournals" oftype:@"plist"]; nsmutablearray *plistjournals = [nsmutablearray arraywithcontentsoffile:plistpath];  //create bunch of journals (nsdictionary *journal in plistjournals) {     [tjournal journalwithdictionary:journal inmanagedobjectcontext:context]; }  nserror *error = nil; [context save:&error];  // ------ create view controller ------ // scrolling list journallistvc *jvc = [[journallistvc alloc] init];  // adjust status bar's height cgrect viewframe = cgrectoffset(jvc.view.frame, 0.0, 20.0); jvc.view.frame = viewframe;  jvc.managedobjectcontext = context;  // add view controller screen [self.window addsubview:jvc.view]; [self.window makekeyandvisible];  return yes; } 

currently, app crashes following error when leave cgrect viewframe line in:

"terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: '+entityforname: not locate nsmanagedobjectmodel entity name 'tjournal''"

if comment out cgrect line, runs fine. call inside loop executes fine (it write's data core data db entity names tjournal, , it's supposed.) obviously, there no dependence on core data cgrectoffset, i'm guessing error spurious. can't, life of me, figure out.

i've tried cleaning targets, wiping out database in simulator, etc. nothing seems work.

any ideas? thanks!

note when reference jvc.view.frame, dynamically loading jvc’s view. if contents of view (or xib!) have dependency on managed object context when it’s loaded, produce error.

try moving jvc.managedobjectcontext = context; line right after journallistvc *jvc = [[journallistvc alloc] init];.

(ps: view shouldn’t have account status bar; instead, uiwindow should it, , view controller’s view’s frame should window’s bounds.)


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -