Search code examples
ioscfnetworknsapptransportsecurity

CFNetwork internal error: CFNetworkInternal.h:478


My iOS device logs (on simulator and real devices) was filled with a couple dozen lines of the following error spam:

CFNetwork internal error (0xc01a:/BuildRoot/Library/Caches/com.apple.xbs/Sources/CFNetwork_Sim/CFNetwork-758.0.2/ProjectRuntime/CFNetworkInternal.h:478)

Why am I seeing these, and how do I get rid of them?


Solution

  • Turns out this was due to an incorrect setup in my Info.plist's NSAppTransportSecurity.

    Make sure that for each of the NSExceptionDomains you use, the subfields of the dictionary (such as NSIncludesSubdomains, NSExceptionRequiresForwardSecrecy, and NSExceptionAllowsInsecureHTTPLoads) are set to type Boolean, not String. While XCode may display your values of YES and NO very similarly, the type is important for ensuring CFNetwork is able to understand your config without any errors.

    Incorrect: Incorrect setup

    Correct: Correct setup