{"id":736,"date":"2013-09-01T19:11:54","date_gmt":"2013-09-01T19:11:54","guid":{"rendered":"http:\/\/triangleappshow.com\/?p=736"},"modified":"2022-12-15T06:46:43","modified_gmt":"2022-12-15T11:46:43","slug":"core-data-and-ios","status":"publish","type":"post","link":"https:\/\/michaelrowe01.com\/index.php\/blog\/core-data-and-ios\/","title":{"rendered":"Core Data and iOS"},"content":{"rendered":"<p>I&#8217;ve been working on a new app lately, and I&#8217;ve taken this time to try and teach myself CoreData. \u00a0CoreData is the mechanism by which Apple has taken traditional SQL database and mapped it to the programming model used in iOS apps. \u00a0Over the next few blog entries I will try and describe my learning process, in the hope that it will help others pick up CoreData. \u00a0Also, I hope to start a dialog to help others, and myself, work thru any challenges which come up during this process.<\/p>\n<p>If you are just starting, I find that Apple&#8217;s Core Data template app, is always a good way of understanding how it is all pulled together. \u00a0So let&#8217;s give that a shot by starting with a MasterDetail Application. \u00a0To do this, create a new Project and select Master Detail:<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/i0.wp.com\/rowewp.mydrobo.com\/wp-content\/uploads\/2013\/09\/Screen-Shot-2013-09-01-at-2.58.05-PM.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-737 aligncenter\" alt=\"Master Detail\" src=\"https:\/\/i0.wp.com\/rowewp.mydrobo.com\/wp-content\/uploads\/2013\/09\/Screen-Shot-2013-09-01-at-2.58.05-PM-300x205.jpg?resize=300%2C205&#038;ssl=1\" width=\"300\" height=\"205\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>After you select that, fill in the next screen. \u00a0I have chosen to create a Universal Binary since I think you should always start from there, it exposes you to the ins and outs of MVC (Model View Controller). \u00a0Don&#8217;t forget to chose CoreData and Automatic Reference Counting.<\/p>\n<p>After choosing the location for the project&#8230; give it a compile. \u00a0You should have a working CoreData application, that can render on either the iPad or iPhone simulator.<\/p>\n<p style=\"text-align: center;\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-739 aligncenter\" style=\"font-size: 12px; line-height: 18px;\" alt=\"Master Detail Detail Screen\" src=\"https:\/\/i0.wp.com\/rowewp.mydrobo.com\/wp-content\/uploads\/2013\/09\/Screen-Shot-2013-09-01-at-2.58.47-PM-300x201.jpg?resize=300%2C201&#038;ssl=1\" width=\"300\" height=\"201\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>As you can see from the following screen shots both the iPad:<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/i0.wp.com\/rowewp.mydrobo.com\/wp-content\/uploads\/2013\/09\/Screen-Shot-2013-09-01-at-3.03.32-PM.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-738 aligncenter\" alt=\"iPad Sample Core Data\" src=\"https:\/\/i0.wp.com\/rowewp.mydrobo.com\/wp-content\/uploads\/2013\/09\/Screen-Shot-2013-09-01-at-3.03.32-PM-300x230.jpg?resize=300%2C230&#038;ssl=1\" width=\"300\" height=\"230\" \/><\/a><\/p>\n<p>and the iPhone:<\/p>\n<p style=\"text-align: left;\"><a href=\"https:\/\/i0.wp.com\/rowewp.mydrobo.com\/wp-content\/uploads\/2013\/09\/Screen-Shot-2013-09-01-at-3.03.59-PM.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-740 aligncenter\" alt=\"iPhone Core Data\" src=\"https:\/\/i0.wp.com\/rowewp.mydrobo.com\/wp-content\/uploads\/2013\/09\/Screen-Shot-2013-09-01-at-3.03.59-PM-155x300.jpg?resize=155%2C300&#038;ssl=1\" width=\"155\" height=\"300\" \/><\/a>are working fine!<\/p>\n<p style=\"text-align: left;\">So what do we really have here? We have a simple app that if you click the plus will create a new record (date time stamp) and a detail screen that will show that time stamp.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/i0.wp.com\/rowewp.mydrobo.com\/wp-content\/uploads\/2013\/09\/Screen-Shot-2013-09-01-at-3.09.21-PM.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-742 aligncenter\" alt=\"Detail Screen\" src=\"https:\/\/i0.wp.com\/rowewp.mydrobo.com\/wp-content\/uploads\/2013\/09\/Screen-Shot-2013-09-01-at-3.09.21-PM-300x232.jpg?resize=300%2C232&#038;ssl=1\" width=\"300\" height=\"232\" \/><\/a><\/p>\n<p style=\"text-align: left;\">That&#8217;s pretty much it.<\/p>\n<p style=\"text-align: left;\">In the next post I will go a bit deeper on all the files that Apple created for you automatically when you chose this template.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been working on a new app lately, and I&#8217;ve taken this time to try and teach myself CoreData. \u00a0CoreData is the mechanism by which Apple has taken traditional SQL database and mapped it to the programming model used in iOS apps. \u00a0Over the next few blog entries I will try and describe my learning [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"hide_page_title":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2],"tags":[97,98,217,403],"class_list":["post-736","post","type-post","status-publish","format-standard","hentry","category-blog","tag-core-data","tag-coredata","tag-ios","tag-tutorial"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2aMa8-bS","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/736","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/comments?post=736"}],"version-history":[{"count":1,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/736\/revisions"}],"predecessor-version":[{"id":2863,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/736\/revisions\/2863"}],"wp:attachment":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/media?parent=736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/categories?post=736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/tags?post=736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}