到处搜索后我发现有一种方法可以使用以下 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)
}
I am using CoreTelephony framework
我们会提供任何帮助
查看其他应用后,我发现 GigSky 也在做同样的事情,有人知道他们在做什么吗?
更新:
截至目前,我在下方找到了授权请求 URL 检查
https://developer.apple.com//contact/request/esim-access-entitlement
我请求了,但 apple 没有响应。
最佳答案
通过此过程,您可以将 eSIM 功能集成到您的 iOS 应用中。
第一步
使用您的开发者帐户请求 eSIM 授权 Request from here
第 2 步
苹果会在一段时间后批准授权(对我来说花了几个月) 您可以检查 Apple 是否已从您的应用配置文件设置中批准该权利
第 3 步
下载 App Dev and Distribution 配置文件(通过选择 eSIM 授权作为步骤 #2)。
第四步
使用以下键和值更新您的 info.plist
<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/>
第 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/