• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core data design related question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core data design related question


  • Subject: Re: Core data design related question
  • From: Stamenkovic Florijan <email@hidden>
  • Date: Thu, 22 Oct 2009 10:10:12 -0400

Hi Marc,

On Oct 20, 2009, at 16:11, Marc Rink wrote:

Heyas,

I am quite new to Objective-C (and to some extend to OO concepts as well), so please be gentle with me :)

I have a core data based document application that purpose is to access a mysql database (i am using the MCP Kit).
The documents in my context are Views that contain different aspects of the database (small portions consisting of some tables related to each other).
One document contains the connection parameters for the database.


I am switching the views according to Aaron Hillegass' example using a view controller (the downloadable examples are http://www.bignerdranch.com/solutions/Cocoa-3rd.tgz) .

I want to achive the following:
Upon application start the first view "ConfigViewController" is shown. It contains all connection related parameters (such as host, port, user, password and database) and a "Connect" button.
Upon clicking the "Connect" button, the connection to the database is established. The result is a connection object, that i wanted to pass around the different Views.


First approach was to pass the resulting connection to the superclass of the view's (all my view's are derived from a custom superclass which extends NSViewController). For reasons i dont know, i didnt get this to work. The resulting object was invalid (nil) in the other view's.

Second approch (and better one imho) is to add a core data entity "DBConfiguration" holding all connection parameters (persistent, so you dont have to enter the stuff every time) and a transient property for the connection object (of type undefined).
I added a Object Controller to my documents xib file, set the mode to "Entity" and the entity name to "DBConfiguration".
My Problem now is: The view containing the textfields and the "connect" button are in a different xib file (ConfigView.xib, whose Files Owner is of Type "ConfigViewController". I dont know how to bind the ConfigView's text fields to the Object Controller in MyDocument.xib.

OK, this was a lot of info. What is your actual problem? Can't you simply make another object controller for DBConfig in ConfigView.xib?


Also note that CoreData is probably not the right solution for storing your connection info. From what you say the user defaults system seems much more appropriate.

I am still new to the different frameworks and unsure about whether my design is acceptable or if i am on a completely wrong way.

When taking on so much at once (as you claim to be inexperienced), it is almost guaranteed you are not doing things the right way. Still, your app seems quite complex and it does not make sense trying to explain it all when looking for a solution for a reasonably small problem. I am sure you'd get more answers if you put the question to the point.


Also, if you are really new to all of this stuff, this sounds like a big first step. Too big. Start with small, isolated functionalities and practice.

F
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Core data design related question
      • From: Marc Rink <email@hidden>
References: 
 >Core data design related question (From: Marc Rink <email@hidden>)

  • Prev by Date: NSScroller graphical lag/glitches
  • Next by Date: Re: Opening a NSSavePanel as a Sheet, and blocking like in [panel runModal]
  • Previous by thread: Core data design related question
  • Next by thread: Re: Core data design related question
  • Index(es):
    • Date
    • Thread