简体   繁体   中英

Ionic push notification for iOS

I'm doing an Ionic project with Notifications functionality and it works for Android but with iOS, I am having a lot of problems. I read and did all the steps in the Ionic guide to implementing Push Notifications: https://docs.ionic.io/services/push/

In summary: I create Cloud Notification Client for my app, and I added ionic cloud like this:

npm install@ionic/cloud --save

and add the files to my index.html I define the Promise installing:

npm install bluebird --save

And I configurated my app:

angular.module('starter', ['ionic', 'ionic.cloud', 'starter.controllers', 'starter.services'])

.config(function($ionicCloudProvider) {
  $ionicCloudProvider.init({
    "core": {
      "app_id": "APP_ID"
    }
  });
}) 

Then to configure the Notifications to iOS I did the same that this guide: https://docs.ionic.io/services/profiles/#android-gcm-project--api-key

  1. Register app ID
  2. Device Registration
  3. Create signin Request with keychain.
  4. I created iOS App Certificate & Provisioning Profile
  5. Convert .cer in .p12
  6. I did the provisioning profile of my app
  7. I went to the Ionic Cloud Dashboard and updload the .p12 and .mobileprovision to my Profile
  8. Create the iOS push Certificate of my app
  9. And then I upload this certificate to the Ionic Cloud Dashboard.

Finally I did the set up in my app, and build and run in a real device, android and iOS. The problem is that in Android it works perfectly, but in iOS I save the token perfectly but nothing arrive when I send the notification from Ionic Cloud Dashboard.

Any help?

Thanks a million!

I may be very late in answering your question.Answer is as follows..

  1. Update your ionic to version v2 and above, use command "$npm install ionic cordova " for that.
  2. Then follow this one carefully http://nishanthkabra.com/ionic2push.html you can implement it very easily.
  3. I also suggest rather then ionic.io use java or php code for sending push notification, because they will be very easy for customization.

At first Install following Plugin under your project

cordova plugin add https://github.com/phonegap/phonegap-plugin-push

You will also need a .pem file and passphrase, you can follow this link for generating them: Generate .pem file Used to setup Apple PUSH Notification

Download following code from here: https://drive.google.com/open?id=0B_-b-DfCLwKdREkwZFdYVEhYWXM

Then merge code in your app.js and after that run your application in iphone and check in console device if you are getting token or not, if device token is showing then move on to next step.

Then you can store device token in database when user login or register.

Then enter your [.pem] file location and pass phrase in [db.class.php]

Then enter device token in [sendIphonenotification.php] file

Then execute [sendIphonenotification.php] file and check your iphone you will get a notification.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM