https://www.jianshu.com/p/6ad09374053b
https://stackoverflow.com/questions/33011466/ios-using-charles-with-alamofire-and-ssl
https://stackoverflow.com/questions/15768143/ios-app-ssl-handshake-failed
On iOS11 I missed this additional step.
In the Settings
app,
Navigate to General
.About
.Certificate settings
.
Enable the Charles Proxy SSL Proxying
switch.
第一步:
設置->通用->描述文件->charles proxy custom root certificate
第二步:
設置->通用->關於本機->證書信任設置-> 找到charles proxy custom root certificate然後信任該證書即可.