{"id":783,"date":"2013-08-10T18:44:39","date_gmt":"2013-08-10T22:44:39","guid":{"rendered":"http:\/\/blog.alanporter.com\/?p=783"},"modified":"2013-08-10T18:44:39","modified_gmt":"2013-08-10T22:44:39","slug":"iphone-dev-notes","status":"publish","type":"post","link":"https:\/\/alanporter.com\/blog\/2013\/08\/10\/iphone-dev-notes\/","title":{"rendered":"iPhone dev notes: things that I got stuck on"},"content":{"rendered":"<p>Here are some things that I got stuck on this weekend while trying to work on iPhone apps.<\/p>\n<h3>Simulator ran my app in 3.5-inch (iPhone 4 size) instead of 4.0-inch (iPhone 5 size).<\/h3>\n<p>I wasted a lot of time on this one.<\/p>\n<p>Whenever I ran the app in the simulator, it would launch in the shorter (640-960) 3.5-inch screen, even if I had previously chosen the taller (640&#215;1136) 4.0-inch screen size.<\/p>\n<p>In Xcode, there is a pulldown at the upper left where you can define your &#8220;scheme&#8221;. \u00a0It looks like this:<\/p>\n<p><a href=\"\/blog\/wp-content\/uploads\/2013\/08\/xcode-scheme.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-785\" alt=\"xcode-scheme\" src=\"\/blog\/wp-content\/uploads\/2013\/08\/xcode-scheme-300x96.png\" width=\"300\" height=\"96\" \/><\/a><\/p>\n<p>Here&#8217;s a cool trick. \u00a0This is the menu where you can set certain parameters for when you build, run, debug, profile and archive the app. \u00a0For example, you can set the simulator&#8217;s screen size by clicking on the app name on the left of the scheme widget and choosing &#8220;Edit Scheme&#8230;&#8221;. \u00a0Then select the &#8220;Run MyApp.app&#8221; action on the left, the &#8220;Options&#8221; tab, and set the &#8220;iPhone simulator display&#8221; to the size that you want to use each time you run.<\/p>\n<p>But still, even if I chose the 4-inch display in my scheme&#8217;s &#8220;run&#8221; action, the simulator ignored this setting and opened in a 3.5-inch display.<\/p>\n<p>The problem is that iOS 5.0 does not support the 4-inch display. \u00a0The taller display debuted with the iPhone 5, which came with iOS 6.0.<\/p>\n<p>So the solution is to just change the target to &#8220;iPhone 6.0 simulator&#8221;. \u00a0Then slap your forehead and say &#8220;duh!&#8221;.<\/p>\n<h3>Error: A valid provisioning profile for this executable was not found.<\/h3>\n<p>I had been preparing an app for submission into the App Store. \u00a0Then I went to run it on my local device again, and it kept popping up an error message: &#8220;A valid provisioning profile for this executable was not found.&#8221;<\/p>\n<p>I went into the project&#8217;s &#8220;Build Settings&#8221;, and I checked all of the values in the &#8220;Code Signing&#8221; section. \u00a0I made sure that the &#8220;AdHoc&#8221; and &#8220;Debug&#8221; entries were set to <em>iPhone Developer (currently matches &#8216;iPhone Developer: Alan Porter (ABCDE12345)&#8217; in &#8216;MyProvProfile&#8217;)<\/em>. \u00a0The &#8220;AppStore&#8221; entry was set to <em>iPhone Distribution (currently matches &#8216;iPhone Distribution: Sentosa.US (LMNOP67890) in &#8216;VWXYZ12345.us.sentosa.Tipster&#8217;)<\/em>. \u00a0These settings are important. \u00a0They tell Xcode to sign your local development builds using your developer certificate, and to sign your App Store submissions using your team&#8217;s distribution certificate.<\/p>\n<p>But once again, the problem was in the &#8220;scheme&#8221; menu. \u00a0Under the &#8220;Run MyApp.app&#8221; action and &#8220;Info&#8221; tab, my &#8220;Build Configuration&#8221; was mistakenly set to &#8220;AppStore&#8221;. \u00a0This won&#8217;t work, because for local builds, you need to sign the code with your own developer certificate. \u00a0The Distribution certificate should only be used when you&#8217;re submitting your app to the App Store.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are some things that I got stuck on this weekend while trying to work on iPhone apps. Simulator ran my app in 3.5-inch (iPhone 4 size) instead of 4.0-inch (iPhone 5 size). I wasted a lot of time on this one. Whenever I ran the app in the simulator, it would launch in the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,15],"tags":[],"class_list":["post-783","post","type-post","status-publish","format-standard","hentry","category-iphone","category-tips-tricks","count-0","even alt","author-alan","last"],"_links":{"self":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts\/783","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/comments?post=783"}],"version-history":[{"count":0,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts\/783\/revisions"}],"wp:attachment":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/media?parent=783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/categories?post=783"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/tags?post=783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}