{"id":174,"date":"2015-01-22T00:09:05","date_gmt":"2015-01-22T00:09:05","guid":{"rendered":"http:\/\/ricardomoinhos.com\/?p=174"},"modified":"2015-01-22T00:09:05","modified_gmt":"2015-01-22T00:09:05","slug":"importing-data-easily-with-magicalrecord-and-coredata","status":"publish","type":"post","link":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/","title":{"rendered":"Importing Data Easily with MagicalRecord and CoreData"},"content":{"rendered":"<p>One difficulty I&#8217;ve come across when trying to use Magical Record&#8217;s\u00a0MR_importFromObject method, was that the primary key attribute was not my entity name plus &#8220;ID&#8221;.<\/p>\n<p>And the tags used in the file being imported were also different from my entity attributes.<\/p>\n<p>To indicate which attribute must be considered as Primary Key (since categoryID does not exist), you should select your entity and, in the user info, add a new key &#8220;relatedByAttribute&#8221; with the attribute value.<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"webkit-fake-url:\/\/51458b5e-2108-4e20-a513-6ba974adf972\/image.tiff\" \/><\/p>\n<p>If your attribute name is different than the tag used in the file being imported, then you must tell coredata how to do the match.<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"webkit-fake-url:\/\/a78b7940-5949-40b0-8d5e-c7126c4fd20e\/image.tiff\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One difficulty I&#8217;ve come across when trying to use Magical Record&#8217;s\u00a0MR_importFromObject method, was that the primary key attribute was not my entity name plus &#8220;ID&#8221;. And the tags used in the file being imported were also different from my entity attributes. To indicate which attribute must be considered as Primary Key (since categoryID does not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[5],"tags":[19,21,18,20],"class_list":["post-174","post","type-post","status-publish","format-standard","hentry","category-ios","tag-coredata","tag-import","tag-ios-2","tag-magicalrecord"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Importing Data Easily with MagicalRecord and CoreData - Ricardo Paiva Moinhos<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/\" \/>\n<meta property=\"og:locale\" content=\"pt_PT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Importing Data Easily with MagicalRecord and CoreData - Ricardo Paiva Moinhos\" \/>\n<meta property=\"og:description\" content=\"One difficulty I&#8217;ve come across when trying to use Magical Record&#8217;s\u00a0MR_importFromObject method, was that the primary key attribute was not my entity name plus &#8220;ID&#8221;. And the tags used in the file being imported were also different from my entity attributes. To indicate which attribute must be considered as Primary Key (since categoryID does not [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/\" \/>\n<meta property=\"og:site_name\" content=\"Ricardo Paiva Moinhos\" \/>\n<meta property=\"article:published_time\" content=\"2015-01-22T00:09:05+00:00\" \/>\n<meta property=\"og:image\" content=\"\" \/>\n<meta name=\"author\" content=\"Ricardo Paiva Moinhos\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ricardo Paiva Moinhos\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tempo estimado de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minuto\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/importing-data-easily-with-magicalrecord-and-coredata\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/importing-data-easily-with-magicalrecord-and-coredata\\\/\"},\"author\":{\"name\":\"Ricardo Paiva Moinhos\",\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/#\\\/schema\\\/person\\\/16dcfdd54ec1c46bd1941659739de4cc\"},\"headline\":\"Importing Data Easily with MagicalRecord and CoreData\",\"datePublished\":\"2015-01-22T00:09:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/importing-data-easily-with-magicalrecord-and-coredata\\\/\"},\"wordCount\":109,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/importing-data-easily-with-magicalrecord-and-coredata\\\/#primaryimage\"},\"thumbnailUrl\":\"webkit-fake-url:\\\/\\\/51458b5e-2108-4e20-a513-6ba974adf972\\\/image.tiff\",\"keywords\":[\"coredata\",\"import\",\"ios\",\"magicalrecord\"],\"articleSection\":[\"iOS\"],\"inLanguage\":\"pt-PT\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/importing-data-easily-with-magicalrecord-and-coredata\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/importing-data-easily-with-magicalrecord-and-coredata\\\/\",\"url\":\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/importing-data-easily-with-magicalrecord-and-coredata\\\/\",\"name\":\"Importing Data Easily with MagicalRecord and CoreData - Ricardo Paiva Moinhos\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/importing-data-easily-with-magicalrecord-and-coredata\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/importing-data-easily-with-magicalrecord-and-coredata\\\/#primaryimage\"},\"thumbnailUrl\":\"webkit-fake-url:\\\/\\\/51458b5e-2108-4e20-a513-6ba974adf972\\\/image.tiff\",\"datePublished\":\"2015-01-22T00:09:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/#\\\/schema\\\/person\\\/16dcfdd54ec1c46bd1941659739de4cc\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/importing-data-easily-with-magicalrecord-and-coredata\\\/#breadcrumb\"},\"inLanguage\":\"pt-PT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/importing-data-easily-with-magicalrecord-and-coredata\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-PT\",\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/importing-data-easily-with-magicalrecord-and-coredata\\\/#primaryimage\",\"url\":\"webkit-fake-url:\\\/\\\/51458b5e-2108-4e20-a513-6ba974adf972\\\/image.tiff\",\"contentUrl\":\"webkit-fake-url:\\\/\\\/51458b5e-2108-4e20-a513-6ba974adf972\\\/image.tiff\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/importing-data-easily-with-magicalrecord-and-coredata\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ricardomoinhos.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Importing Data Easily with MagicalRecord and CoreData\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/#website\",\"url\":\"https:\\\/\\\/ricardomoinhos.com\\\/\",\"name\":\"Ricardo Paiva Moinhos\",\"description\":\"Welcome\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ricardomoinhos.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-PT\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ricardomoinhos.com\\\/#\\\/schema\\\/person\\\/16dcfdd54ec1c46bd1941659739de4cc\",\"name\":\"Ricardo Paiva Moinhos\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-PT\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/248366f4e615e182964f85f799c6e33cbd541a6f4ca7ee948fc16d1c14030c76?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/248366f4e615e182964f85f799c6e33cbd541a6f4ca7ee948fc16d1c14030c76?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/248366f4e615e182964f85f799c6e33cbd541a6f4ca7ee948fc16d1c14030c76?s=96&d=mm&r=g\",\"caption\":\"Ricardo Paiva Moinhos\"},\"url\":\"https:\\\/\\\/ricardomoinhos.com\\\/pt\\\/author\\\/ricardopaiva\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Importing Data Easily with MagicalRecord and CoreData - Ricardo Paiva Moinhos","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/","og_locale":"pt_PT","og_type":"article","og_title":"Importing Data Easily with MagicalRecord and CoreData - Ricardo Paiva Moinhos","og_description":"One difficulty I&#8217;ve come across when trying to use Magical Record&#8217;s\u00a0MR_importFromObject method, was that the primary key attribute was not my entity name plus &#8220;ID&#8221;. And the tags used in the file being imported were also different from my entity attributes. To indicate which attribute must be considered as Primary Key (since categoryID does not [&hellip;]","og_url":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/","og_site_name":"Ricardo Paiva Moinhos","article_published_time":"2015-01-22T00:09:05+00:00","og_image":[{"url":"webkit-fake-url:\/\/51458b5e-2108-4e20-a513-6ba974adf972\/image.tiff","type":"","width":"","height":""}],"author":"Ricardo Paiva Moinhos","twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"Ricardo Paiva Moinhos","Tempo estimado de leitura":"1 minuto"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/#article","isPartOf":{"@id":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/"},"author":{"name":"Ricardo Paiva Moinhos","@id":"https:\/\/ricardomoinhos.com\/#\/schema\/person\/16dcfdd54ec1c46bd1941659739de4cc"},"headline":"Importing Data Easily with MagicalRecord and CoreData","datePublished":"2015-01-22T00:09:05+00:00","mainEntityOfPage":{"@id":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/"},"wordCount":109,"commentCount":0,"image":{"@id":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/#primaryimage"},"thumbnailUrl":"webkit-fake-url:\/\/51458b5e-2108-4e20-a513-6ba974adf972\/image.tiff","keywords":["coredata","import","ios","magicalrecord"],"articleSection":["iOS"],"inLanguage":"pt-PT","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/","url":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/","name":"Importing Data Easily with MagicalRecord and CoreData - Ricardo Paiva Moinhos","isPartOf":{"@id":"https:\/\/ricardomoinhos.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/#primaryimage"},"image":{"@id":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/#primaryimage"},"thumbnailUrl":"webkit-fake-url:\/\/51458b5e-2108-4e20-a513-6ba974adf972\/image.tiff","datePublished":"2015-01-22T00:09:05+00:00","author":{"@id":"https:\/\/ricardomoinhos.com\/#\/schema\/person\/16dcfdd54ec1c46bd1941659739de4cc"},"breadcrumb":{"@id":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/#breadcrumb"},"inLanguage":"pt-PT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/"]}]},{"@type":"ImageObject","inLanguage":"pt-PT","@id":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/#primaryimage","url":"webkit-fake-url:\/\/51458b5e-2108-4e20-a513-6ba974adf972\/image.tiff","contentUrl":"webkit-fake-url:\/\/51458b5e-2108-4e20-a513-6ba974adf972\/image.tiff"},{"@type":"BreadcrumbList","@id":"https:\/\/ricardomoinhos.com\/pt\/importing-data-easily-with-magicalrecord-and-coredata\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ricardomoinhos.com\/"},{"@type":"ListItem","position":2,"name":"Importing Data Easily with MagicalRecord and CoreData"}]},{"@type":"WebSite","@id":"https:\/\/ricardomoinhos.com\/#website","url":"https:\/\/ricardomoinhos.com\/","name":"Ricardo Paiva Moinhos","description":"Welcome","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ricardomoinhos.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-PT"},{"@type":"Person","@id":"https:\/\/ricardomoinhos.com\/#\/schema\/person\/16dcfdd54ec1c46bd1941659739de4cc","name":"Ricardo Paiva Moinhos","image":{"@type":"ImageObject","inLanguage":"pt-PT","@id":"https:\/\/secure.gravatar.com\/avatar\/248366f4e615e182964f85f799c6e33cbd541a6f4ca7ee948fc16d1c14030c76?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/248366f4e615e182964f85f799c6e33cbd541a6f4ca7ee948fc16d1c14030c76?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/248366f4e615e182964f85f799c6e33cbd541a6f4ca7ee948fc16d1c14030c76?s=96&d=mm&r=g","caption":"Ricardo Paiva Moinhos"},"url":"https:\/\/ricardomoinhos.com\/pt\/author\/ricardopaiva\/"}]}},"jetpack_featured_media_url":"","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ricardomoinhos.com\/pt\/wp-json\/wp\/v2\/posts\/174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ricardomoinhos.com\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ricardomoinhos.com\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ricardomoinhos.com\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ricardomoinhos.com\/pt\/wp-json\/wp\/v2\/comments?post=174"}],"version-history":[{"count":1,"href":"https:\/\/ricardomoinhos.com\/pt\/wp-json\/wp\/v2\/posts\/174\/revisions"}],"predecessor-version":[{"id":175,"href":"https:\/\/ricardomoinhos.com\/pt\/wp-json\/wp\/v2\/posts\/174\/revisions\/175"}],"wp:attachment":[{"href":"https:\/\/ricardomoinhos.com\/pt\/wp-json\/wp\/v2\/media?parent=174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ricardomoinhos.com\/pt\/wp-json\/wp\/v2\/categories?post=174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ricardomoinhos.com\/pt\/wp-json\/wp\/v2\/tags?post=174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}