Through CRISPR-Cas9 inactivation of B2M and CIITA and lentiviral transfection carrying CD47 gene, the engineered HiPSCs-derived islet cells survived in immunocompetent, allogeneic diabetic humanized mice for 4 weeks and ameliorated diabetes at least 29 days and rhesus macaques hypoimmune iPSCs-derived islets survived for 40 weeks in an allogeneic recipient without immunosuppression. The gene discussed is B2M; the disease is diabetes mellitus.