ESIM Development CoreTelephony: magic .unknown state always returns immediately

Hello! Our application uses eSIM and some sdk that uses CoreTelephony, but implementation is hidden. When we initialize sdk in AppDelegate esim method CTCellularPlanProvisioning.addPlan() works successfully, but without initialization it always returns .unknown state. Unfortunately, I can't find out exactly what CoreTelephony related functions are executed in this SDK's initialization method.

General configuration: iOS 15 on device. Xcode 14 version. Esim entitlement has received and added to the provision file.

Plist configuration:

<key>CarrierDescriptors</key>
<array>
     <dict>
     <key>MCC</key> //Mobile country code
         <string>’mnc value’</string>
     <key>MNC</key> // Mobile network code
         <string>’mnc value’</string>
     </dict>
</array>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.CommCenter.fine-grained</key>
<array>
    <string>spi</string>
    <string>sim-authentication</string>
    <string>identity</string>
</array>
<key>com.apple.wlan.authentication</key>
<true/>
<key>keychain-access-groups</key>
<array>
    <string>apple</string>
    <string>com.apple.identities</string>
    <string>com.apple.certificates</string>
</array>
<key>com.apple.private.system-keychain</key>
<true/>

{appname}.entitlements file's configuration is:

<key>com.apple.CommCenter.fine-grained</key>
<array>
    <string>public-cellular-plan</string>
</array> 

Code with Esim:

 if #available(iOS 12.0, *) {
      let provisioning = CTCellularPlanProvisioning()
      let request = CTCellularPlanProvisioningRequest()
      request.address = productOrder.platformAddress
      request.matchingID = productOrder.matchingId

      provisioning.addPlan(with: request) { [weak self] result in
          DispatchQueue.main.async {
              guard let self = self else {
                return
              }

              switch result {
              case .fail:
                break
              case .success:
                break
              default:
                break
              }
          }
      }
}
Answered by ergl1s in 731333022

The problem was in the CTTelephonyNetworkInfo object. I used a strong reference to this object in the AppDelegate and it worked.

let telephonyNetworkInfo = CTTelephonyNetworkInfo()
Accepted Answer

The problem was in the CTTelephonyNetworkInfo object. I used a strong reference to this object in the AppDelegate and it worked.

let telephonyNetworkInfo = CTTelephonyNetworkInfo()

Hi, I'm facing the same issue, but I did not understand how did you solve it?

ESIM Development CoreTelephony: magic .unknown state always returns immediately
 
 
Q