Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6678335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:13:49+00:00 2026-05-26T04:13:49+00:00

Would you modify a view controllers initializer to get the NSManagedObjectContext from the appdelegate?

  • 0

Would you modify a view controllers initializer to get the NSManagedObjectContext from the appdelegate?

or would you use this method?

NSManagedObjectContext *context = [(MyAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:13:50+00:00Added an answer on May 26, 2026 at 4:13 am

    I normally use the line that you provided and it works perfectly fine.

    NSManagedObjectContext *context = [[[UIApplication sharedApplication] delegate] managedObjectContext];
    

    One thing I have found in all of my Cocoa development is that there are many ways to skin a cat. Usually what works best for you is the best way to go about it.

    Another way you could do it is to add the NSManagedObjectContext to the NIB and then add outlets to it in all of your other controllers that need a reference to it. That would require a bit of modification to your App Delegate though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to get the html code a view would generate in a
I would like modify HTML like I am <b>Sadi, novice</b> programmer. to I am
Given my current .htaccess file, how would I modify it to check for an
I would like to modify a Spotlight metadata attribute of a file within my
I would like to modify the string in a .h file with NAnt before
We have a customer that would like to modify application user messages that we
I have a String which I would like to modify in some way. For
I'm absolutely new to JavaScript and would like to modify a textarea of a
I'm using HighLine to write my console application and I would like to modify
I have code, similar to the following, that I would like to modify: Sub

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.