avivais / phonegap-parse-plugin

Phonegap 3.0.0 plugin for Parse.com push service
195 stars 315 forks source link

Can't register Push Notification service with iOS Devices - PhoneGap ParsePlugin #90

Open Farukest opened 8 years ago

Farukest commented 8 years ago

I'm using PhoneGap ParsePlugin. I can register to "parse.com Push Notification Service" with my Android devices. Everything clear with Android but not with Ios. Whatever i tried i couldn't register.

I followed these steps on my Apple Developer Account

  1. I created a "Certificate" with Ad Hoc on my developer.apple.com account.
  2. Created an "App IDs" with Push Notifications ( configured and enabled the "Distribution-Push Notifications" ) and then download the Certificate. Let's say it's name : "PushNotification" certificate.
  3. Created a two device with UUID's
  4. Created a Provisioning Profile (Distribution) with Ad Hoc ( added App ID and devices to this provision )

PhoneGap Build

  1. Added Certificate (Ad Hoc)
  2. Added Provisioning Profile (Ad Hoc)
  3. Activated the key.
  4. Rebuild and created an ipa succesfully (app).

Parse.com

  1. Created and ".p12" certificate from "PushNotification" certificate which downloaded after created and App ID.
  2. Added this certificate to "Apple Push Certificate" on parse.com.

Here is my code:

onDeviceReady: function() {
  try {
      parsePlugin.initialize("appID", "clientKey");
  }catch (err){
      alert(err.message);
  }
}

and register with :

var parsePlugin = {

initialize: function(appId, clientKey, successCallback, errorCallback) {
    cordova.exec(
        successCallback,
        errorCallback,
        'ParsePlugin',
        'initialize',
        [appId, clientKey]
    );
},

Hope you can help me. Thanks in advance.

Giabanga commented 8 years ago

+1

zinglax commented 8 years ago

Do you get an error message from your try/catch block? I was having issues yesterday and when I was debugging with safari the parse.initialize() was not throwing and error, just basically skipped over it. From my experience when this was happening it was because my certs were not correct. I have gotten iOS to work with this plugin.

MichaelKuhinica commented 8 years ago

@zinglax did you change anything in your iOS build code to make it work? I'm also having problems to make it work on IOS, it looks like it's skipping the initialization without errors.

zinglax commented 8 years ago

@MichaelKuhinica no not anything specific when it comes iOS vs Android. Make sure your App ID is the same for the project and for the .p12 file you upload to Parse. I also had issues when they were not the same. Ex. my app was com.xalginz.test and my .p12 was com.zinglax.test and my code would skip the initialize().

Giabanga commented 8 years ago

On iOS 8 and 9, I had to use production provisioning profile (ad hoc) and push certs to make it work

MichaelKuhinica commented 8 years ago

I managed to kind of make it work. I had to use the production provisioning profile, as @Giabanga suggested but I couldn't subscribe to the default channel, I will try the different approaches suggested on issue #65 and report back.

zinglax commented 8 years ago

I was able to get the development keys working. Not sure how or why though.

MichaelKuhinica commented 8 years ago

@zinglax on iOS > 8? I got it working with distribution keys, but used this fork instead: https://github.com/denisbabineau/phonegap-parse-plugin

zinglax commented 8 years ago

@MichaelKuhinica yeah im actually using this one for the call backhttps://github.com/grrrian/phonegap-parse-plugin