Pushwoosh / pushwoosh-phonegap-plugin

Pushwoosh PhoneGap Build Plugin
Other
110 stars 139 forks source link

Application not found error #198

Closed Slavezix closed 7 years ago

Slavezix commented 8 years ago

Hello there,

I'm using your latest Pushwoosh plugin for Phonegap. Also Phonegap is up-to-date.

While using Xcode 7.3.1,

i have <script type="text/javascript" src="js/index.js"></script> at header and function initPushwoosh() { var pushwoosh = cordova.require("pushwoosh-cordova-plugin.PushNotification");


  // Should be called before pushwoosh.onDeviceReady
  document.addEventListener('push-notification', function(event) {
    var notification = event.notification;
    // handle push open here
  });

  // Initialize Pushwoosh. This will trigger all pending push notifications on start.
  pushwoosh.onDeviceReady({
    appid: "B7641-E900E",
    projectid: "GOOGLE_PROJECT_NUMBER",
    serviceName: "MPNS_SERVICE_NAME"
  });
}

pushwoosh.registerDevice(
  function(status) {
    var pushToken = status.pushToken;
      // handle successful registration here
      console.log("success");
  },
  function(status) {
    // handle registration error here
    console.log("fail");
  } 

at just before body closing. I set all certificates and profiles but log says;

[PW] [I] -[PushNotificationManager] Will show push notifications alert: 1 2016-08-16 02:03:11.928 Bilemezsin[1194:113075] [PW] [I] -[PWLocationTracker] location services authorization status has not been determined yet 2016-08-16 02:03:11.997 Bilemezsin[1194:113075] Resetting plugins due to page load. 2016-08-16 02:03:13.042 Bilemezsin[1194:113075] Finished load of: file:///private/var/mobile/Containers/Bundle/Application/F4B93D02-320C-4222-822F-79E27294F98C/Bilemezsin.app/www/index.html 2016-08-16 02:03:15.490 Bilemezsin[1194:113111] [PW] [I] -[PWRequestManager] x | Pushwoosh request: | Url: https://cp.pushwoosh.com/json/1.3/getInApps | Payload: {"request":{"device_type":1,"language":"tr","application":"","userId":"58C4E81A-4989-495F-A3F1-510F526C1872","v":"4.0.4.","hwid":"58C4E81A-4989-495F-A3F1-510F526C1872"}} | Status: "200 no error" | Response: {"status_code":210,"status_message":"Application not found","response":null} x 2016-08-16 02:03:15.718 Bilemezsin[1194:113109] [PW] [I] -[PWRequestManager] x | Pushwoosh request: | Url: https://cp.pushwoosh.com/json/1.3/registerUser | Payload: {"request":{"device_type":1,"application":"","userId":"58C4E81A-4989-495F-A3F1-510F526C1872","v":"4.0.4.","hwid":"58C4E81A-4989-495F-A3F1-510F526C1872"}} | Status: "200 no error" | Response: {"status_code": 200, "status_message": "OK","response":null} x

When I run on my iPhone 5. What am I doing wrong?

And no registered subscriber of course.

Slavezix commented 8 years ago

I solved this problem by adding `

Pushwoosh_APPID
<string>B7641-E900E</string>

` to .plist file but still there is no new subscriber.

DimanAM commented 8 years ago

onDeviceReady() initializes plugin with your application id. It should be called before any other plugin function.

  1. Please make sure pushwoosh.registerDevice() is called after pushwoosh.onDeviceReady()
  2. Make sure both methods are actually called. You will see https://cp.pushwoosh.com/json/1.3/applicationOpen and https://cp.pushwoosh.com/json/1.3/registerDevice requests in device logs if everything is done correctly.
brianjohnhanna commented 8 years ago

I am having the same exact issue. Setting the Pushwoosh_APPID did seem to fix the 210 response error, but still no prompt to allow notifications on the device. It also is not showing up as registered in the Pushwoosh account.

2016-08-30 17:53:04.559 Danvers PS[365:44807] [PW] [I] -[PWRequestManager] 
x
|    Pushwoosh request:
| Url:      https://cp.pushwoosh.com/json/1.3/registerUser
| Payload:  {"request":{"device_type":1,"application":"FD807-89D5C","userId":"26DFE0BD-F7D2-4504-B8CD-84793F580CFE","v":"4.0.4.","hwid":"26DFE0BD-F7D2-4504-B8CD-84793F580CFE"}}
| Status:   "200 no error"
| Response: {"status_code": 200, "status_message": "OK","response":null}
x
2016-08-30 17:53:04.866 Danvers PS[365:44805] [PW] [I] -[PWRequestManager] 
x
|    Pushwoosh request:
| Url:      https://cp.pushwoosh.com/json/1.3/getInApps
| Payload:  {"request":{"device_type":1,"language":"en-US","application":"FD807-89D5C","userId":"26DFE0BD-F7D2-4504-B8CD-84793F580CFE","v":"4.0.4.","hwid":"26DFE0BD-F7D2-4504-B8CD-84793F580CFE"}}
| Status:   "200 no error"
| Response: {"status_code":200,"status_message":"OK","response":{"inApps":[]}}
x

I am not seeing any call to the /applicationOpen/ endpoint. The only thing I see similar is:

2016-08-30 17:52:59.070 Danvers PS[365:44747] [PW] [I] +[UIApplication(Pushwoosh)] Pushwoosh: Initializing application runtime

which appears at the top of the Xcode log. This did work at one point and seems to be related to updating to the latest version of the Pushwoosh plugin and updating the corresponding SDK calls. My code is called exactly as is described in the docs and in your last comment.

DimanAM commented 8 years ago

1. Make sure you call onDeviceReady() function. You can set breakpoint here to see if it's actually called. 2. Make sure you call registerDevice() function after onDeviceReady(). You can set breakpoint here to see if it's actually called.