I'm using the below code to activate Esim,
UIBackgroundTaskIdentifier backgroundTaskIdentifier = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{}];
[plan addPlanWith:request completionHandler:^(CTCellularPlanProvisioningAddPlanResult result) {
if (result==CTCellularPlanProvisioningAddPlanResultFail){
NSError *error = [NSError errorWithDomain:@"react.native.simcardsmanager.handler" code:1 userInfo:nil];
reject(@"2", @"CTCellularPlanProvisioningAddPlanResultFail - Can't add an Esim subscription", error);
}else if (result==CTCellularPlanProvisioningAddPlanResultUnknown){
NSError *error = [NSError errorWithDomain:@"react.native.simcardsmanager.handler" code:1 userInfo:nil];
reject(@"3", @"CTCellularPlanProvisioningAddPlanResultUnknown - Can't setup eSim due to unknown error", error);
}else{
//CTCellularPlanProvisioningAddPlanResultSuccess
resolve(@(true));
}
[[UIApplication sharedApplication] endBackgroundTask:backgroundTaskIdentifier];
}];
When I call the method, it will simultaneously open the "Add Cellular Plan" wizard and return the CTCellularPlanProvisioningAddPlanResultUnknown. However, in the end, the Esim will add successfully, but I will not receive the prosperous state in "completion handler."