title: Troubleshooting Apple Push Notification Services
body: <p>My push notifications were working roughly a month ago. I am working in production push notifications. I haven't worked on my project for a while because of other engagements, and when I came back, I was no longer able to send a push notification. </p>
  
  <p>After creating a log that is linked up to my production sns, I've noticed this: </p>
  
  <blockquote>
    <p>"delivery": {
            "deliveryId": "d3675e8a-45b0-58db-9b79-11e284987bbb",
            "destination": "arn:aws:sns:us-east-1:445291524102:endpoint/APNS/BusyTime/587673f1-cf48-3b3e-9e74-04d39f8affc3",
            "providerResponse": "NotificationErrorResponse(command=8, status=InvalidToken, id=1, cause=null)",
            "dwellTimeMs": 319,
            "attempts": 1,
            "token": "55d7b18b064eecad93fb666818651d4f33b612487ee810b092f081cef41d4e43",
            "statusCode": 8
        },</p>
  </blockquote>
  
  <p>After investigating the matter I started to try to check my credentials to see if I could get into the server.</p>
  
  <p>I tried using the apple docs which led me to this command: </p>
  
  <pre><code>openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert BusyTimeProductionKey.pem -debug -showcerts -CAfile ProductionAPS.pem
  </code></pre>
  
  <p>And I used Raywenderlich.com tutorial to set it up a while back and used this command to check it out again:</p>
  
  <pre><code>openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert ProductionAPS.pem -key BusyTimeProductionKey.pem
  </code></pre>
  
  <p>Both of which spit out a large amount of output and gave me this line to indicate that the connection was okay:
  SSL handshake has read 3160 bytes and written 2319 bytes</p>
  
  <p>However, I also noticed this line above everything that looked like it worked: </p>
  
  <pre><code>verify error:num=20:unable to get local issuer certificate
  verify return:0
  </code></pre>
  
  <p>Does the error line have anything to do with this error? If not, how should I approach fixing this problem of mine? Please keep in mind that I've set a debugging point in xcode, manually grabbed the device token for a device I'm testing, and inserted it into the sns console to isolate that it was not with a bad token. Thank you for your time and consideration. I also have a theory that I might not be using the correct provisioning profile. Would I need to check if I'm using the production provisioning profile? If so, how would I do that? </p>