IOS: CXCallObserverDelegate: callChanged not triggering


I’m developing a NativeScript application which will make use of listening to the call state of the phone. For this i’m using CXCallObserver and CXCallObserverDelegate which I set up as following:

    module.exports = {
        phoneDelegate: NSObject.extend({
            initWithResolveReject: function(resolve, reject){
                var self = this.super.init();
                    this.resolve = resolve;
                    this.reject = reject;
                return self;

            callObserverCallChanged: function(observer, call){
                console.log("This log is not triggering");
                    //  call has ended
                    this.resolve({phoneState: "ended"});
                if(call.isOutgoing && !call.hasConnected){
                    //  Dialing out
                    this.resolve({phoneState: "outgoing call"});
                if(!call.isOutgoing && !call.hasConnected && !call.hasEnded){
                    //  Call is incoming
                    this.resolve({phoneState: "incoming call"});
                if(call.hasConnected && !call.hasEnded){
                    //  Call is ongoing
                    this.resolve({phoneState: "ongoing call"});
        }, {
            protocols: [CXCallObserverDelegate]

        registerListener: function(){
            return new Promise((resolve, reject) => {
                    this.callObserver = new CXCallObserver();

                    let myCallDelegate = this.phoneDelegate.alloc().initWithResolveReject(resolve, reject);
                    this.callObserver.setDelegateQueue(myCallDelegate, null);
                    console.log("phone listener registered");
                } catch(error) {
                    reject({error: error});

The listener is getting registered as it should, at least no errors are thrown and the last console log in “registerListener” is executed as it should.

When I try to make a phone call, either incoming or outgoing nothing happens. At least the first console log in “callObserverCallChanged” should execute on any phone state change. But nothing happens.

I have achieved this on Android where it’s working as intended but IOS just wont work for me.

Any one got a suggestion of what might be wrong?


I have reported this issue to NativeScript’s github page so anyone interested follow here


Ok the solution was quite embarrassing. The myCallDelegate instance was destroyed before doing anything due to not assigning it to the class. Well here is the solution:

this.myCallDelegate = this.phoneDelegate.alloc().initWithResolveReject(resolve, reject);
this.callObserver.setDelegateQueue(this.myCallDelegate, null);

Shoutout to tsonevn for taking his time and finding this misstake.