iOS eSIM开发

关于 iPhone 上的 eSIM

官方文档:

https://support.apple.com/zh-cn/HT212780

iOS eSIM开发步骤

申请eSIMAPI使用权限

配置项目

使用eSIMAPI

一.申请eSIMAPI使用权限

申请地址:

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

申请通过后在开发者后台会出现如下选项:

[email protected]

二.配置项目

info.plist

com.apple.security.network.servercom.apple.security.network.clientcom.apple.CommCenter.fine-grainedspisim-authenticationidentitycom.apple.wlan.authenticationkeychain-access-groupsapplecom.apple.identitiescom.apple.certificatescom.apple.private.system-keychain

设置支持运营商列表

https://support.apple.com/zh-cn/HT209096

经测试 中可以没有内容(添加MCC/MNC的目的还不知道是为了什么,知道的同学可以指点一下),但一定要有CarrierDescriptors这个key

否则这个方法 [[CTCellularPlanProvisioning new] supportsCellularPlan] 不会去请求Apple服务器,一直返回false。

CarrierDescriptorsMCC460MNC00

{appname}.entitlements

com.apple.CommCenter.fine-grainedpublic-cellular-plan

重新生成包含eSIM Entitlements的profile

三.使用eSIMAPI

检测设备是否支持eSIM

+(BOOL)supportsCellularPlan{if(@available(iOS12.0,*)){return[[CTCellularPlanProvisioning new]supportsCellularPlan];}else{returnNO;}}

下载安装eSIM配置

+(void)addPlanWithAddress:(NSString*)address matchingID:(NSString*)matchingID confirmationCode:(NSString*)confirmationCode completionHandler:(void(^)(CTCellularPlanProvisioningAddPlanResult result))completionHandlerAPI_AVAILABLE(ios(12.0)){

CTCellularPlanProvisioningRequest * provisioningRequest = [CTCellularPlanProvisioningRequest new];

provisioningRequest.address = address;

provisioningRequest.matchingID = matchingID;

provisioningRequest.confirmationCode = confirmationCode;

[[CTCellularPlanProvisioning new]addPlanWith:provisioningRequest completionHandler:^(CTCellularPlanProvisioningAddPlanResult result){

completionHandler(result);

switch(result){

case CTCellularPlanProvisioningAddPlanResultUnknown:

NSLog(@"Unknown");

break;

case CTCellularPlanProvisioningAddPlanResultFail:

NSLog(@"Fail");

break;

case CTCellularPlanProvisioningAddPlanResultSuccess:

NSLog(@"Success");

break;

}}];}

eSIM安装流程图


eSIM激活码规则

[email protected]

[email protected]

安装流程以及效果截图

IMG_0035.png

你可能感兴趣的:(iOS eSIM开发)