title: IOS5: Icon Badging in non-running state
body: <p>I searched a lot for a solution to handle icon badging while the application is not running.</p>
  
  <p>I wrote an app that receives push notifications but, while in running state i can update the badge in the <code>application:didReceiveRemoteNotification:</code> function, i still can't figure out how to update the icon badge while the application is not running.</p>
  
  <p>The "Badge App Icon" switch is ON under the notifications menu of my app but when receiving remote notifications the icon badge is not updated.</p>
  
  <p>The code is running on a device, no simulator involved.</p>
  
  <p>My notification contains a badge</p>
  
  <pre><code>$body['aps'] = array(
  'alert' =&gt; $message,
  'sound' =&gt; 'default',
  'badge' =&gt; '1' // Wrong, see edit...
  );
  </code></pre>
  
  <p>I'm using a simple php script to generate it.</p>
  
  <p>Am i missing something?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I found out that i was sending the badge properties as a string instead of a number.</p>
  
  <p>The correct code in php is:</p>
  
  <pre><code>$body['aps'] = array(
  'alert' =&gt; $message,
  'sound' =&gt; 'default',
  'badge' =&gt; 1 // Right
  );
  </code></pre>
  
  <p>With the numeric badge value the icon badge is correctly updated.</p>