搜索到所有地方后,我发现可以使用以下API在iPhone中添加eSIM

func addPlan(with: CTCellularPlanProvisioningRequest, completionHandler: (CTCellularPlanProvisioningAddPlanResult) -> Void)

我不知道为什么,但是完成处理程序不返回CTCellularPlanProvisioningAddPlanResult的结果,只是打印以下错误。
Domain=NSCocoaErrorDomain Code=4099 "The connection to service named
com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo=
{NSDebugDescription=The connection to service named
com.apple.commcenter.coretelephony.xpc was invalidated.

我想知道此API的工作原理,您可以在下面看到我的代码
let ctpr = CTCellularPlanProvisioningRequest()
ctpr.address = "SMDP+"
ctpr.confirmationCode = ""
ctpr.eid = ""
ctpr.iccid = ""

let ctcp =  CTCellularPlanProvisioning()
ctcp.addPlan(with: ctpr) { (result) in
    print(result)
}



任何帮助都将被申请

在检查了其他应用程序之后,我发现GigSky在执行相同的操作,有人知道他们的执行情况吗?

更新:

到目前为止,我在下面找到了权利请求URL检查

https://developer.apple.com//contact/request/esim-access-entitlement

我要求但苹果没有回应。

最佳答案

通过此过程,您可以将eSIM功能集成到您的iOS应用中。

步骤1

使用您的开发者帐户请求eSIM授权
Request from here

步骤2

苹果将​​在一段时间后批准该权利(对我而言,这花费了几个月的时间)
您可以从应用程序配置文件设置中检查Apple是否已批准该权利
ios - (eSIM集成iOS)如何使用受限API  "addPlan"在iOS设备中启用e-sim配置文件-LMLPHP

步骤3

下载App Dev and Distribution配置文件(通过选择eSIM权利作为步骤#2)。

步骤4

使用以下键和值更新您的info.plist

<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/>

步骤5 (可以为可选)

使用以下键和值更新您的{appname} .entitlements
<key>com.apple.CommCenter.fine-grained</key>
<array>
    <string>public-cellular-plan</string>
</array>

步骤6 代码以添加eSIM个人资料
 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")
            }
        }
    }

关于ios - (eSIM集成iOS)如何使用受限API "addPlan"在iOS设备中启用e-sim配置文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53605419/

10-10 01:53