Answers.Body: <p>I finally figured this out! </p>
  
  <p>For any iOS application, in order to test the "Production" alerts to a physical iPhone Device -> You have to create an Ad-Hoc Application and deploy that to your iPhone device. </p>
  
  <p>In order to do this, you must have an Ad-Hoc Distribution Profile created in the Member Center of "Certificates, Identifiers, and Profiles. </p>
  
  <p>See this page for more information: <a href="https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/TestingYouriOSApp/TestingYouriOSApp.html" rel="nofollow">https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/TestingYouriOSApp/TestingYouriOSApp.html</a></p>
  
  <p>When using the Push Notification Plugin in debug mode, it works with the sandbox URL of Apple's Push Alerts. It will not use the production URL if you have debugMode set to true in the general.php file of Craft's configs.</p>
  
  <p>Note: You will also have to set up the production certificate and configure that in the Push Notification Plugin settings to use the PEM file for the Production. </p>
  
  <p>Once you deploy an Ad-Hoc Application to your iPhone device and have the PEM file setting pointed to your Production certificate, then everything should work fine (Make sure debugMode is set to false or remove this setting from the general.php file), the device will receive the alert.</p>
  
  <p>I have tested this and it works on my iPhone 6 device.</p>
  
  <p><strong>Nothing is wrong with the ZendFramework or Push Notification code.</strong> </p>
  
  <p>The issue was the deployment for the application on the iPhone device. I was testing directly from Xcode and using its build which is a development build (not an Ad-Hoc Build).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T19:13:46.277Z
Answers.LastActivityDate: 2016-05-09T19:13:46.277Z
Answers.UserDisplayName: Sandy D.
Body: <p>The <a href="https://github.com/boboldehampsink/pushnotifications" rel="nofollow noreferrer">Push Notification</a> plugin will send out alerts ONLY if devMode is set to true.</p>
  
  <p>I can't leave my production environment in development mode so I'm trying to figure out why the alerts won't send when devMode is set to false.</p>
  
  <p>I have checked the <code>PushNotifications_PushService.php</code> page and the logs will print out that Notified is 1 (which would be correct for my test). However, the alert never sends out. My phone never receives the alert.</p>
  
  <p>My only assumption is that it deals with the APNSAdapter but that is coming from Sly/NotificationPusher. I've never worked with this class before so I'm not sure exactly how it works. Does anyone have any ideas what is going on?</p>
  
  <p>UPDATE 1:</p>
  
  <p>I am pretty sure the problem deals with the NotificationPusher class that the developer is importing. However, I'm not sure what is wrong with it. </p>
  
  <p>See this: <a href="https://stackoverflow.com/questions/27611388/phonegap-pushplugin-with-notificationpusher-not-working-in-production">https://stackoverflow.com/questions/27611388/phonegap-pushplugin-with-notificationpusher-not-working-in-production</a> </p>
  
  <p>Here is an issue also posted on the NotificationPusher GitHub:
  <a href="https://github.com/Ph3nol/NotificationPusher/issues/111" rel="nofollow noreferrer">https://github.com/Ph3nol/NotificationPusher/issues/111</a></p>
  
  <p>UPDATE 2:</p>
  
  <p>Tested via command line using the following command:
  ./np push --certificate=/path/to/production_ck.pem apns deviceToken "Notification test"</p>
  
  <p>This worked. No errors. Phone received alert. </p>
  
  <p>Still not sure why it won't receive them from Plugin in Production Mode.</p>
  
  <p><strong>UPDATE 3:</strong></p>
  
  <p>I have placed log statements into the NotificationPusher class. I found no errors when comparing it to the "Dev" process. </p>
  
  <p>I noticed when debugging the NotificationPusher project that it utilizes zendframework APNS to send the messages. My assumption is that the error must be somewhere within this project.</p>
  
  <p>I found this: <a href="http://framework.zend.com/manual/1.12/en/zend.mobile.push.apns.html" rel="nofollow noreferrer">http://framework.zend.com/manual/1.12/en/zend.mobile.push.apns.html</a></p>
  
  <p>In the first comment, he isn't getting any errors either but the alert is never getting to the device.</p>
  
  <p>As far as the NotificationPusher project, I was able to determine that:</p>
  
  <ol>
  <li>It is getting the device token and the message data </li>
  <li>The response data is the same for both development mode and production mode. (However, the iPhone device never receives the alert message in production mode.) Still no error from code</li>
  </ol>
  
  <p>Has anyone worked with the Zendframework? Any ideas what is going on?</p>
  
  <p><strong>UPDATE 4:</strong></p>
  
  <p>The only difference I have found so far is that the development mode uses the sandbox URL whereas the production mode uses the production mode. </p>
  
  <p>What doesn't make sense is that I'm using my production certificate and it works on the sandbox URL but it doesn't work on the production URL.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-05-09T18:39:59.360Z
Comments.Text: Is your app compiled in Xcode to use production URLs?
Comments.UserDisplayName: RitterKnight
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-05-09T18:43:06.603Z
Comments.Text: Yes. The URLs are correct. I'm beginning to think something is up with the certificates. It's very weird but my production certificate is working with the Sandbox URL. I do not know why. This makes no sense to me.
Comments.UserDisplayName: Sandy D.
Tags: <devmode><plugin-pushnotifications>
Title: Push Notification plugin will not send iOS alerts when Craft CMS devMode is set to false
ThreadText: # Push Notification plugin will not send iOS alerts when Craft CMS devMode is set to false
  
  (Asked by: username_0 on 2016-05-06)
  
  The [Push Notification](https://github.com/boboldehampsink/pushnotifications) plugin will send out alerts ONLY if devMode is set to true.
  
  I can't leave my production environment in development mode so I'm trying to figure out why the alerts won't send when devMode is set to false.
  
  I have checked the `PushNotifications_PushService.php` page and the logs will print out that Notified is 1 (which would be correct for my test). However, the alert never sends out. My phone never receives the alert.
  
  My only assumption is that it deals with the APNSAdapter but that is coming from Sly/NotificationPusher. I've never worked with this class before so I'm not sure exactly how it works. Does anyone have any ideas what is going on?
  
  UPDATE 1:
  
  I am pretty sure the problem deals with the NotificationPusher class that the developer is importing. However, I'm not sure what is wrong with it.
  
  See this: <https://stackoverflow.com/questions/27611388/phonegap-pushplugin-with-notificationpusher-not-working-in-production>
  
  Here is an issue also posted on the NotificationPusher GitHub:
  <https://github.com/Ph3nol/NotificationPusher/issues/111>
  
  UPDATE 2:
  
  Tested via command line using the following command:
  ./np push --certificate=/path/to/production\_ck.pem apns deviceToken "Notification test"
  
  This worked. No errors. Phone received alert.
  
  Still not sure why it won't receive them from Plugin in Production Mode.
  
  **UPDATE 3:**
  
  I have placed log statements into the NotificationPusher class. I found no errors when comparing it to the "Dev" process.
  
  I noticed when debugging the NotificationPusher project that it utilizes zendframework APNS to send the messages. My assumption is that the error must be somewhere within this project.
  
  I found this: <http://framework.zend.com/manual/1.12/en/zend.mobile.push.apns.html>
  
  In the first comment, he isn't getting any errors either but the alert is never getting to the device.
  
  As far as the NotificationPusher project, I was able to determine that:
  
  1. It is getting the device token and the message data
  2. The response data is the same for both development mode and production mode. (However, the iPhone device never receives the alert message in production mode.) Still no error from code
  
  Has anyone worked with the Zendframework? Any ideas what is going on?
  
  **UPDATE 4:**
  
  The only difference I have found so far is that the development mode uses the sandbox URL whereas the production mode uses the production mode.
  
  What doesn't make sense is that I'm using my production certificate and it works on the sandbox URL but it doesn't work on the production URL.
  
  **Tags:** devmode, plugin-pushnotifications
  
  > **Comments:**
  > **username_1**: Is your app compiled in Xcode to use production URLs?  
  > **username_0**: Yes. The URLs are correct. I'm beginning to think something is up with the certificates. It's very weird but my production certificate is working with the Sandbox URL. I do not know why. This makes no sense to me.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-05-09. Score: 2 | Accepted answer
  
  I finally figured this out!
  
  For any iOS application, in order to test the "Production" alerts to a physical iPhone Device -> You have to create an Ad-Hoc Application and deploy that to your iPhone device.
  
  In order to do this, you must have an Ad-Hoc Distribution Profile created in the Member Center of "Certificates, Identifiers, and Profiles.
  
  See this page for more information: <https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/TestingYouriOSApp/TestingYouriOSApp.html>
  
  When using the Push Notification Plugin in debug mode, it works with the sandbox URL of Apple's Push Alerts. It will not use the production URL if you have debugMode set to true in the general.php file of Craft's configs.
  
  Note: You will also have to set up the production certificate and configure that in the Push Notification Plugin settings to use the PEM file for the Production.
  
  Once you deploy an Ad-Hoc Application to your iPhone device and have the PEM file setting pointed to your Production certificate, then everything should work fine (Make sure debugMode is set to false or remove this setting from the general.php file), the device will receive the alert.
  
  I have tested this and it works on my iPhone 6 device.
  
  **Nothing is wrong with the ZendFramework or Push Notification code.**
  
  The issue was the deployment for the application on the iPhone device. I was testing directly from Xcode and using its build which is a development build (not an Ad-Hoc Build).
  
  
  ---
  
  