title: iOS: Production push notifications, Invalid token from APNS server
body: <p>My app is now available in the app store, so I've downloaded it to my device. The push notifications were working fine during development. I am using JavaPNS to send out the notifications, and I have switch it to point to Apple's production servers.</p>
  
  <p>However, I'm now getting an Invalid Token error back from the APNS servers. </p>
  
  <p>I have the Archive scheme set to "Release", and I have Release set to use this distribution profile:</p>
  
  <p><img src="https://i.stack.imgur.com/Dnij9.png" alt="enter image description here"></p>
  
  <p>Inside that provisioning file, you can see that I have the environment set correctly:</p>
  
  <p><img src="https://i.stack.imgur.com/aZN6w.png" alt="enter image description here"></p>
  
  <p>Yet I still get the error. When I look in my database, I think the device token the app is returning to me is the same as the development one, so that could be the problem. But I don't know why it would be returning that, given that the app is signed correctly. This is a device I also used for testing, could that be a problem? Any other ideas about what's happening here?</p>
  
  <p>Thanks!</p>
  
  <p>EDIT: I'm not storing a token in my code, Eran's answer suggests that the only other possibilities are an old token in my database, or the app not being signed by a production profile. I'm cleared my database, so I know it's not the former, and as for the latter, I don't see how that could be the case, since I only have one distribution profile, and as I've shown above, it has the "aps-environment" key set correctly. XCode wouldn't even let me use a development profile for app store submission, would it? A few other possibilities:</p>
  
  <p>Is it possible that something being wrong with key I'm sending with my notifications could cause "Invalid Token"? If so, can I regenerate this key for my existing profiles?</p>
  
  <p>Isn't there another provisioning profile contained in the AppID for the purposes of push notifications? Could a problem with that cause the invalid token error?</p>