title: How to fix "no valid 'aps-environment' entitlement string found for application" in Xcode 4.3?
body: <p>I've been trying very very hard to create a simple simple iOS app which can recieve push notifications.  My only reason for doing this is to establish a procedure for some other team members to use, and have not been able to find an up to date, working version of such instructions elsewhere on the web.  Our shop is fairly new to iOS dev, I personally am completely inexperienced with iOS dev and Xcode.  I've stumbled through tens of tutorials, articles, and trouble posts from Apple and elsewhere and I feel like I might be nearly there...  </p>
  
  <p>Here is where I've got to (note I'm using Xcode 4.3 and trying initially to deploy just to iOS 5.1, and I gather that some things may have changed recently vs earlier versions of Xcode, but again I'm new to all this -- and finding it completely confusing and convoluted):</p>
  
  <p>1) I've got a provisioning profile on my iPhone which has Push enabled</p>
  
  <p>2) In my test Xcode project I've got that provisioning profile selected as the signing identity (in Build Settings > Code Signing)</p>
  
  <p><img src="https://i.stack.imgur.com/17sRO.png" alt="enter image description here"></p>
  
  <p>3) I've got my bundle identifier under Summary and Info > Custom iOS Target Properties set properly* (I think??)</p>
  
  <p>4) I've got registerForRemoteNotificationTypes being called in my delegate's didFinishLaunchingWithOptions</p>
  
  <p>5) I've got didRegisterForRemoteNotificationsWithDeviceToken and didFailToRegisterForRemoteNotificationsWithError in my delegate, set up to log the device token or error respectively</p>
  
  <p>6) I've got Enable Entitlements checked under Summary. </p>
  
  <p>7) Right below that the Entitlements File selected is Tinker6 (the name of my test project), which was generated automatically when I checked Enable Entitlements</p>
  
  <p>8) In the Tinker6.entitlements file I've got the following (which I've gathered is correct based on several different posts all over the web, but which I can't find anything definitive from Apple itself on):</p>
  
  <p><img src="https://i.stack.imgur.com/S8Pgo.png" alt="enter image description here"></p>
  
  <p><strong>Updated</strong></p>
  
  <p>9) Also, I have tried the whole thing without an entitlements file, and get essentially the same result.</p>
  
  <p>10) My mobileprovision file contents include entitlements properly (I've scrambled the number and domain but structurally the same):</p>
  
  <pre><code>&lt;key&gt;application-identifier&lt;/key&gt;
  &lt;string&gt;12355456A7.com.whatever.tinker&lt;/string&gt;
  &lt;key&gt;aps-environment&lt;/key&gt;
  &lt;string&gt;development&lt;/string&gt;
  &lt;key&gt;get-task-allow&lt;/key&gt;
  &lt;true/&gt;
  &lt;key&gt;keychain-access-groups&lt;/key&gt;
  &lt;array&gt;
      &lt;string&gt;12355456A7.*&lt;/string&gt;
  &lt;/array&gt;
  </code></pre>
  
  <p><strong>/end update</strong></p>
  
  <p>When I attempt to run this on my device, I get the following error in Xcode output:</p>
  
  <pre><code>2012-06-11 12:45:23.762 Tinker6[13332:707] Failed to get token, error: 
  Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' 
  entitlement string found for application" UserInfo=0x24a3b0 
  {NSLocalizedDescription=no valid 'aps-environment' entitlement string 
  found for application}
  </code></pre>
  
  <p>I've tried setting get-task-allow to NO, aps-environment to production, all four possible combinations, same thing.</p>
  
  <p>How can I get past this?  Where is definitive documentation on this?</p>
  
  <p>-- <em>further background follows</em> --</p>
  
  <p>*As far as the bundle id, I am still not clear on how this should be set in relation to App Ids and Profile ids in the Provisioning profile.  In the Provisioning portal under App Ids I have this (again, scrambled the number and domain):</p>
  
  <p><img src="https://i.stack.imgur.com/la74y.png" alt="enter image description here"></p>
  
  <p>And the two places bundle id is set I have this:</p>
  
  <p><img src="https://i.stack.imgur.com/9Q9jd.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/ifECf.png" alt="enter image description here"></p>
  
  <p>I am not at all sure these are correct or whether one or both should be set to 12355456A7.com.whatever.tinker, though I've tried those earlier in the process with no success...</p>
  
  <p><strong>Note</strong> I realize there are many posts with similar titles, however they all seem to be out of date based on the file names and so-forth given, and the fact none of the solutions seem to be useful.  I'm hoping the greater level of detail I've given will warrant a quality response.  I will probably assign a bounty as soon as possible and if you give a high quality answer that leads to a solution I will award you the bounty as well as promote your answer via twitter and my blog.  Especially if you crosspost post a really good "here are the <em>exact</em> 500 steps you need to get a simple push notification app working including provisioning and whatever else" article on your blog or whatever.</p>