传递“SecTrustResultType *”类型的可保留参数的不兼容指针类型

问题描述 投票:0回答:1

我正在使用

react-native-payments
库进行 ApplePay 并收到以下错误,我不知道该怎么办,请提供帮助吗?

iOS: 16.4
Xcode: 14.3
react-native: 0.71.4
react-native-payments: 0.8.4
Deployment target: 14.0 in Xcode

PPOTSimpleURLConnection.m 文件

        NSString *domain = challenge.protectionSpace.host;
        SecTrustRef serverTrust = [[challenge protectionSpace] serverTrust];

        NSArray *policies = @[(__bridge_transfer id)SecPolicyCreateSSL(true, (__bridge CFStringRef)domain)];
        SecTrustSetPolicies(serverTrust, (__bridge CFArrayRef)policies);
        SecTrustSetAnchorCertificates(serverTrust, (__bridge CFArrayRef)self.pinnedCertificateData);
        SecTrustResultType result;

//        OSStatus errorCode = SecTrustEvaluate(serverTrust, &result);
        OSStatus errorCode = SecTrustEvaluateWithError(serverTrust, &result);

        BOOL evaluatesAsTrusted = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed);
        if (errorCode == errSecSuccess && evaluatesAsTrusted) {
            NSURLCredential *credential = [NSURLCredential credentialForTrust:serverTrust];
            completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
        } else {
            completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, NULL);
        }
    }
ios swift objective-c react-native stripe-payments
1个回答
0
投票

尝试这个解决方法,它将解决您的问题。但这是一个临时修复,您必须在每次安装

pods

时进行这些更改
-        SecTrustResultType result;

-        OSStatus errorCode = SecTrustEvaluate(serverTrust, &result);
+        CFErrorRef error;
+        BOOL trusted = SecTrustEvaluateWithError(serverTrust, &error);

-        BOOL evaluatesAsTrusted = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed);
-        if (errorCode == errSecSuccess && evaluatesAsTrusted) {
+        if (trusted && error == nil) {
© www.soinside.com 2019 - 2024. All rights reserved.