TypeError: $ionicPush.register().then is not a function

Hi everybody,
I’m just about to pull all of my hair out, there’s 10 left or something,
I’ve been trying to get phonegap-plugin-push to work, Following the docs just step by step, yet what I get as a result is frustrating, The token isn’t being saved,
I’m running on actual device,
my code is like

app.config(function($ionicCloudProvider) {
$ionicCloudProvider.init({
“core”: {
“app_id”: “whatever”
} ,
“push”: {
“sender_id”: “whatever”,
“pluginConfig”: {
“ios”: {
“badge”: true,
“sound”: true
},
“android”: {
“iconColor”: “#343434
}
}
}
});
});

and in controller:

$ionicAuth.login(‘basic’, {
password: ‘none’,
email: Session.get(‘fbid’) + ‘@facebook.com’,
}).then(function () {
$ionicPush.register().then(function (t) {
return $ionicPush.saveToken(t);
}).then(function (t) {
console.log(t);
});
});
my console output is just like this:

[Log] Ionic Push: – "register" (192.168.0.29, line 28)
[Log] Ionic Push: – "another registration is already in progress." (192.168.0.29, line 28)
[Log] TypeError: $ionicPush.register().then is not a function. (In '$ionicPush.register().then(function (t) { (192.168.0.29, line 28)
                                    return $ionicPush.saveToken(t);
                                })', '$ionicPush.register().then' is undefined)
(anonymous function) — controllers.js:201
processQueue — ionic.bundle.js:29132
(anonymous function) — ionic.bundle.js:29148
$eval — ionic.bundle.js:30400
$digest — ionic.bundle.js:30216
(anonymous function) — ionic.bundle.js:30439
completeOutstandingRequest — ionic.bundle.js:19199
(anonymous function) — ionic.bundle.js:19475

can anybody give me any tip about what’s wrong in here?
thanks.

Hey!

I don’t know if it help you but when i call $ionicPush.register() i do it in this way:

var callbak = function(token){
console.log('This is my token ’ + token + ‘then im gonna save it!’);
$ionicPush.saveToken(token, {
‘ignore_user’: true
});
}
$ionicPush.register(callback);

Cheers :wink: