4

We added eSim installation in our app and we have 2 flows: automatically install or manual installation of the profile. I did all the configuration required as described here. Manual installation works fine, but we have a problem with the automatically installation of the profile.

The code looks like this:

let planProvisioning = CTCellularPlanProvisioning()
let cellularPlanRequest = CTCellularPlanProvisioningRequest()
cellularPlanRequest.address = eSimResult.address
cellularPlanRequest.matchingID = eSimResult.code

planProvisioning.addPlan(with: cellularPlanRequest) { result in
    // this get's called immediately and the result is always .unknown
    print("cellularPlanRequest result is unknown", result == .unknown)
}

The problem is that the callback is called immediately with the result .unknown right after we call planProvisioning.addPlan(with:) and the system view with starting the install is shown - not when the user finished the install flow (successfully or not).

Did anyone get this to work ok? What did we miss?

Thank you.

Aura
  • 246
  • 1
  • 10

1 Answers1

0

I had the same issue and I was able to fix by declaring and instantiating planProvisioning separately from the func where I add the plan.

class ViewController: UIViewController {
private let planProvisioning = CTCellularPlanProvisioning() //this fixed the issue for me

func createEsimProvisioning() {
    let cellularPlanRequest = CTCellularPlanProvisioningRequest()
    cellularPlanRequest.address = eSimResult.address
    cellularPlanRequest.matchingID = eSimResult.code
    
    planProvisioning.addPlan(with: cellularPlanRequest) { result in
        // this get's called immediately and the result is always .unknown
        print("cellularPlanRequest result is unknown", result == .unknown)
    }
  }
}
marwa_kh
  • 1
  • 4