Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-25-2010, 05:20 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 6
Default Accessing App Delegates Managed Object Context

Hi

My App uses core data and has a UITabBarController set as the root controller.

For any view controllers that are nested in the tab bar controller i can access the App Delegate's Managed Data Context with
Code:
 [(MyAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];
Which is fine, adding/retrieving data okay.

I'm also able to get the context in exactly the same way for views that lie outside of the root controller tab hierarchy,. however i get
Code:
FREED(id): message persistentStoreCoordinator sent to freed object=0x3b4ac70
Program received signal:  “EXC_BAD_INSTRUCTION”.
When i try for example to create an entity description with:
Code:
NSEntityDescription *entityDesc = [NSEntityDescription entityForName:@"TheEntity" inManagedObjectContext:managedObjectContext];
Can anybody shed any light as to why this is happening? Or a lead on how to resolve it?

Thank you

Hanks
Hanks2000 is offline   Reply With Quote
Old 03-17-2010, 10:08 AM   #2 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 15
Default

Are you declaring a ManagedObjectContext in your .h file? If so, try not retaining it, but use readonly -- and don't release it in your .m file. Hope it helps.
Argus is offline   Reply With Quote
Old 03-21-2010, 02:40 PM   #3 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 6
Default

Quote:
Originally Posted by Argus View Post
Are you declaring a ManagedObjectContext in your .h file? If so, try not retaining it, but use readonly -- and don't release it in your .m file. Hope it helps.
Hi Argus
Thank you for your reply. I was releasing it in the m file!
Hanks2000 is offline   Reply With Quote
Reply

Bookmarks

Tags
access, app, context, delegate, managed

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 231
15 members and 216 guests
ADY, AragornSG, Dani77, Dattee, Duncan C, fkmtc, HDshot, HemiMG, Promo Dispenser, Punkjumper, Rudy, sacha1996, sneaky, spiderguy84, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,231
Posts: 380,768
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:15 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0