# Ionic 2 - iOS NotRegistered

**URL:** <https://forum.ionicframework.com/t/ionic-2-ios-notregistered/86952>\
**Category:** ionic-v3\
**Created:** [April 18, 2017, 3:25pm UTC](https://forum.ionicframework.com/t/ionic-2-ios-notregistered/86952 "2017-04-18T15:25:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nemesisaka](https://avatars.discourse-cdn.com/v4/letter/n/898d66/32.png) [@nemesisaka](https://forum.ionicframework.com/u/nemesisaka)\
**Post date:** [April 18, 2017, 3:25pm UTC](https://forum.ionicframework.com/t/ionic-2-ios-notregistered/86952/1 "2017-04-18T15:25:44Z")

</div>

I have done an App in Ionic 2 with the phonegap-plugin-push for notifications.

It works really well with Android but when I try to run it on the iOS it have a few problems.

I can get the registration token but when I do a push message I get the error: NotRegistered as response. Sometimes the first one I got a message sent response but I didn’t receive it on my device. But after that first one any other gives me that error.

What can it be? The wrong certeficates or some bug in code?

I’m using Ionic 2 on a windows, using phonegap to compile the app to iOS so I have to generate the certificates with openSSL.

There is a few of the code for the push notifications:

> config.xml

```
<plugin name="phonegap-plugin-push" spec="1.8.2">
   <variable name="SENDER_ID" value="883847118563"/>
</plugin>

```

> app.component.ts

```
import {Push, PushObject, PushOptions} from "@ionic-native/push";
(...)
platform.ready().then(() => {
  (...)
  this.initPushNotification();
});

initPushNotification() { 
if (!this.platform.is('cordova')) {
  (...)
}
const options: PushOptions = {
  android: {
    senderID: "8838XXXXXXXX"
  },
  ios: {
    senderID: "8838XXXXXXXX" ,
    gcmSandbox: "true",
    alert: "true",
    badge: false,
    sound: 'true'
  },
  windows: {}
};
const pushObject: PushObject = this.push.init(options);

pushObject.on('registration').subscribe((data: any) => {
  (...)
});

pushObject.on('notification').subscribe((data: any) => {
  (...)
});

pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error));
}

```

> app.module.ts

```
import { CloudSettings, CloudModule } from '@ionic/cloud-angular';

const cloudSettings: CloudSettings = {
 'core': {
  'app_id': 'bdeXXXX'
  },
'push': {
  'sender_id': '8838XXXXXXXX',
  'pluginConfig': {
    'ios': {
      'badge': true,
      'sound': true
     },
    'android': {
     'iconColor': '#ff0000'
    }
  }
 }
};

```

Thank you in advance for the help.

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [April 18, 2017, 8:39pm UTC](https://forum.ionicframework.com/t/ionic-2-ios-notregistered/86952/2 "2017-04-18T20:39:16Z")

</div>

Where do you get this error? What exactly does it say?

---

<div class="post-metadata">

**Author:** ![nemesisaka](https://avatars.discourse-cdn.com/v4/letter/n/898d66/32.png) [@nemesisaka](https://forum.ionicframework.com/u/nemesisaka)\
**Post date:** [April 18, 2017, 8:46pm UTC](https://forum.ionicframework.com/t/ionic-2-ios-notregistered/86952/3 "2017-04-18T20:46:25Z")

</div>

In Postman… this is what I got:  
{  
“multicast\_id”: 6003101976233628796,  
“success”: 0,  
“failure”: 1,  
“canonical\_ids”: 0,  
“results”: [  
{  
“error”: “NotRegistered”  
}  
]  
}

For what I have read it seams that something is wrong, so after my first push (succesfull) to APNs the server might give back some error and Firebase unregister my device…

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [April 18, 2017, 8:48pm UTC](https://forum.ionicframework.com/t/ionic-2-ios-notregistered/86952/4 "2017-04-18T20:48:15Z")

</div>

Are you using Ionic Push as a push provider? Or what URL are you calling in Postman?

---

<div class="post-metadata">

**Author:** ![nemesisaka](https://avatars.discourse-cdn.com/v4/letter/n/898d66/32.png) [@nemesisaka](https://forum.ionicframework.com/u/nemesisaka)\
**Post date:** [April 18, 2017, 8:50pm UTC](https://forum.ionicframework.com/t/ionic-2-ios-notregistered/86952/5 "2017-04-18T20:50:44Z")

</div>

Just Firebase…  
The URL is: [https://fcm.googleapis.com/fcm/send](https://fcm.googleapis.com/fcm/send)

---

<div class="post-metadata">

**Author:** ![cikcoh](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@cikcoh](https://forum.ionicframework.com/u/cikcoh)\
**Post date:** [November 13, 2018, 10:46am UTC](https://forum.ionicframework.com/t/ionic-2-ios-notregistered/86952/6 "2018-11-13T10:46:23Z")

</div>

Hi, i’m getting the same error in ios, how did u solved this?

---

<div class="post-metadata">

**Author:** ![cikcoh](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@cikcoh](https://forum.ionicframework.com/u/cikcoh)\
**Post date:** [November 13, 2018, 10:49am UTC](https://forum.ionicframework.com/t/ionic-2-ios-notregistered/86952/7 "2018-11-13T10:49:30Z")

</div>

Hi, i’m getting the same error in ios, android works fine.  
i’m using phone-plugin-push and url [https://fcm.googleapis.com/fcm/send](https://fcm.googleapis.com/fcm/send)  
Can u help me figure out why this is happening

---

<div class="post-metadata">

**Author:** ![nemesisaka](https://avatars.discourse-cdn.com/v4/letter/n/898d66/32.png) [@nemesisaka](https://forum.ionicframework.com/u/nemesisaka)\
**Post date:** [November 13, 2018, 11:14am UTC](https://forum.ionicframework.com/t/ionic-2-ios-notregistered/86952/8 "2018-11-13T11:14:03Z")

</div>

Hello @cikcoh,

I’m sorry but I did this over an year ago and now I don’t really remember how I solved it, however, I can give you some tips.

For iOS compile your app using xCodes, normally what I do is:

> ionic cordova build ios–release

Then go to:

> “Source”\platforms\ios

And use your xCode projected file \ ***.xcodeproj** in xCode to compile.

After that check if you got the correct Apple certificates in your Firebase, it’s pretty confuse and I think this is your issue, getting the right certificate, I remember spending 4 hours looking for the correct certificate.

Hope it helps.

---

<div class="post-metadata">

**Author:** ![cikcoh](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@cikcoh](https://forum.ionicframework.com/u/cikcoh)\
**Post date:** [November 13, 2018, 11:48am UTC](https://forum.ionicframework.com/t/ionic-2-ios-notregistered/86952/9 "2018-11-13T11:48:09Z")

</div>

Hi, i found a workaround here [iOS on FCM not working for debug signed apps + workaround · Issue #2518 · phonegap/phonegap-plugin-push · GitHub](https://github.com/phonegap/phonegap-plugin-push/issues/2518)  
it is caused by this:

> It turns out that Cordova uses a hook during the ios-build, which removes the embedded.mobileprovision that Firebase uses to determine if this is a production app or not. Because this is missing, debug-only signed apps will not receive the correct FCM token when the plugin makes a request to Firebase.

Thanks for your help 🙂
