How to access "Preferred cellular plan" label string of a contact in Swift 4.2?

Hi,


I would like to access the string value of "Prefferred cellular plan" label of a contact person in iOS 12.

Please kindly advise!


Best regards,

Chhay

Replies

Informations about carrier for the phone are in CTCarrier.


To find all information available (with what key), run this (could not find list of keys in documentation):


        let networkInfo = CTTelephonyNetworkInfo()
        let carrier = networkInfo.serviceSubscriberCellularProviders
        for (key, value) in carrier! {
             print(key, value)
        }


Then see if there is a key for preferred carrier.

But i guess that this is a user information not accessible to apps, for confidentiality reason.


In addition, do you want the same info from a person in the contact list ? I don't think it even exists.

Hi Claude,


Thanks for your answer!

"Preferred cellular plan" refers to the new option of a contact in dual iPhone Xs Max. This will allow user make a call using one of the two services at his or her preferrence. I checked the CNContacts framework, but nothing mentioned in the document.

OK, I didn't know. It would be logical to have access to this info.


I have not fount it (in XCode10.1ß3).


Could properties of CTTelephonyNetworkInfo provide it ?

There are 2 that are not described:

var serviceCurrentRadioAccessTechnology: [String : String]?

var serviceSubscriberCellularProviders: [String : CTCarrier]?

I checked the CNContacts framework, but nothing mentioned in the document.

I suspect that Contacts framework hasn’t yet caught up with this innovation. I recommend that you file an enhancement request asking for access to this field. Please post your bug number, just for the record.

btw What are you planning to use this info for?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"