react native https

常炯
2023-12-01

1. ios解决方案

1.1 Xcode打开工程,Libraries -> RCTNetworking -> RCTHTTPRequestHandler.mm -> #pragma mark NSURLSession delegate

添加如下代码

- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
{
completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
}

1.2 ios 工程中 找到 info.plist

1、在Info.plist中添加 NSAppTransportSecurity 类型 Dictionary ;
2、在 NSAppTransportSecurity 下添加 NSAllowsArbitraryLoads 类型Boolean ,值设为 YES;

转载于:https://www.cnblogs.com/shidaying/p/8488300.html

 类似资料:

相关阅读

相关文章

相关问答