{"id":1162,"date":"2014-10-05T17:08:26","date_gmt":"2014-10-05T17:08:26","guid":{"rendered":"https:\/\/zogspat.tk\/blog\/?p=1162"},"modified":"2014-10-05T17:08:26","modified_gmt":"2014-10-05T17:08:26","slug":"setting-gps-data-in-uiimagepickercontrollermediametadata-with-ios-8","status":"publish","type":"post","link":"https:\/\/the-plot.com\/blog\/?p=1162","title":{"rendered":"Setting GPS Data in UIImagePickerControllerMediaMetadata With iOS 8"},"content":{"rendered":"<p>I&#8217;ve been doing some housekeeping on one of the apps I have in the App Store, and I noticed that the image picker was broken when I tested it on the GM version of iOS 8. It took me a while to track it down and, because I couldn&#8217;t see the solution on StackOverflow, I thought I&#8217;d do a quick posting here.<\/p>\n<p>So the background to this is if you want to add something into the\u00a0UIImagePickerControllerMediaMetadata dictionary after you have taken a picture, and the classic example is saving back GPS data.<\/p>\n<p>The long and short of it is that you can no longer assign \u00a0UIImagePickerControllerMediaMetadata straight to a NSMutableDictionary. My code originally looked like this:<\/p>\n<pre>NSMutableDictionary *tmpMetadataDic = [info objectForKey:UIImagePickerControllerMediaMetadata];<\/pre>\n<p>which, if I called it, threw an error like this:<\/p>\n<pre><code>[__NSDictionaryI setObject:forKey:] unrecognized selector sent to instance....<\/code><\/pre>\n<p>The clue is that reference to NSDictionaryI, which means that you&#8217;re trying to set something in a non mutable dictionary.<\/p>\n<p>So doing something like this works:<\/p>\n<div>\n<pre>NSDictionary\u00a0*nonMutytmpMetadataDic = [info\u00a0objectForKey:UIImagePickerControllerMediaMetadata];\u00a0 \u00a0\u00a0\r\nNSMutableDictionary\u00a0*tmpMetadataDic = [[NSMutableDictionary\u00a0alloc]\u00a0initWithDictionary:nonMutytmpMetadataDic];<\/pre>\n<\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been doing some housekeeping on one of the apps I have in the App Store, and I noticed that the image picker was broken when I tested it on the GM version of iOS 8. It took me a &hellip; <a href=\"https:\/\/the-plot.com\/blog\/?p=1162\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1162","post","type-post","status-publish","format-standard","hentry","category-ios-development"],"_links":{"self":[{"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1162"}],"version-history":[{"count":1,"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1162\/revisions"}],"predecessor-version":[{"id":1163,"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1162\/revisions\/1163"}],"wp:attachment":[{"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}