4
votes

Updated my macOS to 10.15 Catalina & also updated xcode to 11.1. Now on building my code I get error "error: unknown type name 'tls_protocol_version_t' ". I cleaned the build folder, reset xcode, cleared xcode cache. Nothing seems to solve the issue.

Complete error log is as follows -

In file included from /My Repo/MyApp/trunk/App/App-Prefix.pch:8:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:128:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLSession.h:744:11: error: unknown type name 'tls_protocol_version_t'

@property tls_protocol_version_t TLSMinimumSupportedProtocolVersion API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0));

3
I also tried xcode 11. Same issue occurs. Reverted to xcode 10.3 & everything works fine.Tushar

3 Answers

0
votes

Not sure is this correct but I added below code at App-Prefix.pch and it resolved the issue.

typedef enum tls_protocol_version_t  {
  tls_protocol_version_TLSv10 = 0x0301,
  tls_protocol_version_TLSv11 = 0x0302,
  tls_protocol_version_TLSv12 = 0x0303,
  tls_protocol_version_TLSv13 = 0x0304,
  tls_protocol_version_DTLSv10 = 0xfeff,
  tls_protocol_version_DTLSv12 = 0xfefd
 } tls_protocol_version_t;
0
votes

I had the same problem using XCode 11.3.1 on MacOS 10.15.3 : A fairly old Objective-C App does not build anymore with the error

Unknown type name `tls_protocol_version_t`

given. It uses a precompiled header file and I tried adding the typedef definition manually as suggested but that just results in more errors.

I ended up adding the typedef directly in

NSURLSession.h

i.e. as root user edited

 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLSession.h

and added the following typedef just after the

NSURLSessionTaskState

typedef:

typedef CF_ENUM(uint16_t, tls_protocol_version_t) {
     tls_protocol_version_TLSv10 CF_SWIFT_NAME(TLSv10) = 0x0301,
     tls_protocol_version_TLSv11 CF_SWIFT_NAME(TLSv11) = 0x0302,
     tls_protocol_version_TLSv12 CF_SWIFT_NAME(TLSv12) = 0x0303,
     tls_protocol_version_TLSv13 CF_SWIFT_NAME(TLSv13) = 0x0304,
     tls_protocol_version_DTLSv10 CF_SWIFT_NAME(DTLSv10) = 0xfeff,
     tls_protocol_version_DTLSv12 CF_SWIFT_NAME(DTLSv12) = 0xfefd,
 };
0
votes

I had the same problem with a rather old project and Xcode 11. Adding the typedef for tls_protocol_version_t from the other answer did work, but was obviously not the ideal solution.

In noticed that I had a copy of Security.framework in the project that was not 'relative to SDK' but 'relative to group' (same for SystemConfiguration.framework/) so I deleted both and reincluded in the target's General > Frameworks settings. That wasn't enough. I noticed that Foundation wasn't there, so I also added it. That did the trick. Conclusion: check your frameworks!