iOS eSIM开发

iOS eSIM开发步骤

  • 申请eSIMAPI使用权限

  • 配置项目

  • 使用eSIMAPI

一.申请eSIMAPI使用权限

申请地址:
https://developer.apple.com/contact/request/esim-access-entitlement

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


二.配置项目

info.plist

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

设置支持运营商列表
http://www.mcc-mnc.com

经测试 中可以没有内容(添加MCC/MNC的目的还不知道是为了什么,知道的同学可以指点一下),但一定要有CarrierDescriptors这个key
否则这个方法 [[CTCellularPlanProvisioning new] supportsCellularPlan] 不会去请求Apple服务器,一直返回false。

CarrierDescriptors
    
        
            MCC
            460
            MNC
            00
        
    

{appname}.entitlements

com.apple.CommCenter.fine-grained
   
       public-cellular-plan
   

重新生成包含eSIM Entitlements的profile

三.使用eSIMAPI

检测设备是否支持eSIM

+ (BOOL)supportsCellularPlan{
   if (@available(iOS 12.0, *)) {
       return [[CTCellularPlanProvisioning new] supportsCellularPlan];
   } else {
       return NO;
   }
}

下载安装eSIM配置

+ (void)addPlanWithAddress:(NSString*)address matchingID:(NSString*)matchingID confirmationCode:(NSString*)confirmationCode completionHandler:(void (^)(CTCellularPlanProvisioningAddPlanResult result))completionHandler  API_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激活码规则

安装流程以及效果截图


IMG_0035.png
IMG_0037.png

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