After searching everywhere I found there is a way to add eSIM in iPhone using the following API
func addPlan(with: CTCellularPlanProvisioningRequest, completion
With this process, you can integrate eSIM functionality into your iOS app.
Step 1
Request for eSIM entitlement using your developer account Request from here
Step 2
Apple will approve the entitlement after some time (For me it took months) You can check if Apple has approved the entitlement from your app profile setting
Step 3
Download the App Dev and Distribution profile (By selecting eSIM entitlement as Step #2).
Step 4
Update your info.plist with below keys and value
com.apple.security.network.server
com.apple.security.network.client
com.apple.CommCenter.fine-grained
spi
sim-authentication
identity
com.apple.wlan.authentication
keychain-access-groups
apple
com.apple.identities
com.apple.certificates
com.apple.private.system-keychain
Step 5 (Could be optional)
Update your {appname}.entitlements with below key and value
com.apple.CommCenter.fine-grained
public-cellular-plan
Step 6 Code to Add eSIM profile
let ctpr = CTCellularPlanProvisioningRequest()
let ctpr = CTCellularPlanProvisioningRequest()
ctpr.address = "Your eSIM profile address"
ctpr.matchingID = "Confirmation id"
if #available(iOS 12.0, *) {
let ctcp = CTCellularPlanProvisioning()
ctcp.addPlan(with: ctpr) { (result) in
switch result {
case .unknown:
self.showGenericSingleButtonCustomAlert(description: "Sorry unknown error")
case .fail:
self.showGenericSingleButtonCustomAlert(description: "Oops! something went wrong")
case .success:
self.showGenericSingleButtonCustomAlert(description: "Yay! eSIM installed successfully")
@unknown default:
self.showGenericSingleButtonCustomAlert(description: "Oops! something went wrong")
}
}
}