iOS倒计时

【转】iOS eSIM开发

2022-09-22  本文已影响0人  铁汁红豆

iOS eSIM开发步骤

申请eSIMAPI使用权限

配置项目

使用eSIMAPI

一.申请eSIMAPI使用权限

申请地址:

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

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

WX20200803-161440@2x.png

二.配置项目

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

设置支持运营商列表

http://www.mcc-mnc.com

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

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

<key>CarrierDescriptors</key><array><dict><key>MCC</key><string>460</string><key>MNC</key><string>00</string></dict></array>

{appname}.entitlements

<key>com.apple.CommCenter.fine-grained</key><array><string>public-cellular-plan</string></array>

重新生成包含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){caseCTCellularPlanProvisioningAddPlanResultUnknown:NSLog(@"Unknown");break;caseCTCellularPlanProvisioningAddPlanResultFail:NSLog(@"Fail");break;caseCTCellularPlanProvisioningAddPlanResultSuccess:NSLog(@"Success");break;}}];}

eSIM安装流程图

eSIM激活码规则

WX20200803-151615@2x.png

WX20200803-151636@2x.png

安装流程以及效果截图

IMG_0035.png

上一篇下一篇

猜你喜欢

热点阅读