getEnabledStatusForExtensionWithIdentifier

Dear Apple Developers,


I am working on an Call Identifier in iOS10 beta. But how do i check if the extension is enabled or disabled?

I know there is this reference but i really don't know where to start 🙂


Hope some of you can guide me in the right direction..


Thank You..!

Accepted Answer

Just want to let you know that i found out my self.

I was as simple as calling the CXCallDirectoryManager.


Sorry for the noise 🙂

Hi, can you please describe (code example) how you did it?


With my code:



let cdm = CXCallDirectoryManager.init();

cdm.getEnabledStatusForExtension(withIdentifier: "com.urnoftheapp.Sperrliste", completionHandler: {

(status:CXCallDirectoryManager.EnabledStatus, e:Error?) -> Void in

if (status == CXCallDirectoryManager.EnabledStatus.enabled)

{

// do something

}

print(status)

print(e)

})


I get the following error:


Optional(Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.CallKit.CallDirectory was invalidated from this process." UserInfo={NSDebugDescription=The connection to service named com.apple.CallKit.CallDirectory was invalidated from this process.})

com.urnoftheapp is placeholder for the URN of the App Bundle, which is the beginning of the URN of the Extension, which just added .Sperrliste


Thanks and Regards,

Emil

Hi Emil, I think you are missing your extension identifier.. E.g. "com.urnoftheapp.Sperrliste.ExtensionIdentifier" /Henrik

Hi,


tanks for your quick answer - but withIdentifier is the bundel identifier of my Extension ... so Sperrliste is the extension addition, while com.urnoftheapp is the identifier of the app alone.


But the good news is, that the code itself seems to be correct, right? So there must be a misconfiguration with the extension id - is there anything to do (I already registered it on the webpage, because of the appgroup entitlement and that is already working)


Thanks,

Emil

Hi Emil.


This is an working example from Obj-C, it should not be so hard to translate it to Swift.

Hope it helps


/ Henrik


[[CXCallDirectoryManager sharedInstance] getEnabledStatusForExtensionWithIdentifier:@"com.untime.Drop.dropCallidentifier" completionHandler:^(CXCallDirectoryEnabledStatus enabledStatus, NSError * _Nullable error) {
        if (enabledStatus == 0) {
            Code 0 tells you that there's an error. Common is that the identifierString is wrong.
        } else if (enabledStatus == 1) {
            Code 1 is deactivated extension
        } else if (enabledStatus == 2) {
            Code 1 is an activated extension
        }
    }];

Thanks! Mistake was to init a new object, instead I have to use a sharedInstance! You have been much faster than the technical support, used one TSI :-( ... but now it works :-)

I'm glad i could help :)

getEnabledStatusForExtensionWithIdentifier
 
 
Q