Search code examples
xcodechromecast

Set up Google Cast API in XCode


I followed the instructions described in https://developers.google.com/cast/docs/ios_sender but when I try to build my project I get 36 linker errors as follows:

Undefined symbols for architecture i386:
  "_SSLClose", referenced from:
      -[GCK_GCDAsyncSocket closeWithError:] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_SSLCreateContext", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_SSLGetBufferedReadSize", referenced from:
      ___37-[GCK_GCDAsyncSocket flushSSLBuffers]_block_invoke in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCK_GCDAsyncSocket doReadData] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_SSLHandshake", referenced from:
      -[GCK_GCDAsyncSocket ssl_continueSSLHandshake] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_SSLRead", referenced from:
      -[GCK_GCDAsyncSocket flushSSLBuffers] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCK_GCDAsyncSocket doReadData] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_SSLSetCertificate", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_SSLSetConnection", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_SSLSetEnabledCiphers", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_SSLSetIOFuncs", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_SSLSetPeerDomainName", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_SSLSetProtocolVersionMax", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_SSLSetProtocolVersionMin", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_SSLWrite", referenced from:
      -[GCK_GCDAsyncSocket doWriteData] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_SecCertificateCopyData", referenced from:
      -[GCKDeviceAuthChannel didReceiveBinaryMessage:] in GoogleCast(GCKDeviceAuthChannel.o)
  "_SecCertificateCreateWithData", referenced from:
      -[GCKDeviceAuthChannel init] in GoogleCast(GCKDeviceAuthChannel.o)
      -[GCKDeviceAuthChannel didReceiveBinaryMessage:] in GoogleCast(GCKDeviceAuthChannel.o)
  "_SecKeyRawVerify", referenced from:
      -[GCKDeviceAuthChannel didReceiveBinaryMessage:] in GoogleCast(GCKDeviceAuthChannel.o)
  "_SecPolicyCreateBasicX509", referenced from:
      -[GCKDeviceAuthChannel didReceiveBinaryMessage:] in GoogleCast(GCKDeviceAuthChannel.o)
  "_SecTrustCopyPublicKey", referenced from:
      -[GCKDeviceAuthChannel didReceiveBinaryMessage:] in GoogleCast(GCKDeviceAuthChannel.o)
  "_SecTrustCreateWithCertificates", referenced from:
      -[GCKDeviceAuthChannel didReceiveBinaryMessage:] in GoogleCast(GCKDeviceAuthChannel.o)
  "_SecTrustEvaluate", referenced from:
      -[GCKDeviceAuthChannel didReceiveBinaryMessage:] in GoogleCast(GCKDeviceAuthChannel.o)
  "_SecTrustGetCertificateAtIndex", referenced from:
      -[GCKDeviceAuthChannel didReceiveBinaryMessage:] in GoogleCast(GCKDeviceAuthChannel.o)
  "_SecTrustGetCertificateCount", referenced from:
      -[GCKDeviceAuthChannel didReceiveBinaryMessage:] in GoogleCast(GCKDeviceAuthChannel.o)
  "_SecTrustSetAnchorCertificates", referenced from:
      -[GCKDeviceAuthChannel didReceiveBinaryMessage:] in GoogleCast(GCKDeviceAuthChannel.o)
  "_kCFStreamNetworkServiceType", referenced from:
      -[GCK_GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamNetworkServiceTypeVoIP", referenced from:
      -[GCK_GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamPropertySSLPeerTrust", referenced from:
      ___33-[GCKCastSocket socketDidSecure:]_block_invoke in GoogleCast(GCKCastSocket.o)
  "_kCFStreamPropertySSLSettings", referenced from:
      -[GCK_GCDAsyncSocket cf_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLAllowsAnyRoot", referenced from:
      -[GCK_GCDAsyncSocket maybeStartTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLAllowsExpiredCertificates", referenced from:
      -[GCK_GCDAsyncSocket maybeStartTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLAllowsExpiredRoots", referenced from:
      -[GCK_GCDAsyncSocket maybeStartTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLCertificates", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLIsServer", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLLevel", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLPeerName", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLValidatesCertificateChain", referenced from:
      -[GCK_GCDAsyncSocket maybeStartTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCKCastSocket connectToHost:port:withTimeout:] in GoogleCast(GCKCastSocket.o)
      -[GCK_GCDAsyncSocket maybeStartTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCKCastSocket connectToHost:port:withTimeout:] in GoogleCast(GCKCastSocket.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I downloaded the sample Hello, Text app from github and it's building without error. What am I doing wrong here?

Update: As suggested by @Rhythmic Fistman, I linked against the Security framework and 23 linker errors were eliminated. However, there are still 13 remaining linker errors as follow:

Undefined symbols for architecture i386:
  "_kCFStreamNetworkServiceType", referenced from:
      -[GCK_GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamNetworkServiceTypeVoIP", referenced from:
      -[GCK_GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamPropertySSLPeerTrust", referenced from:
      ___33-[GCKCastSocket socketDidSecure:]_block_invoke in GoogleCast(GCKCastSocket.o)
  "_kCFStreamPropertySSLSettings", referenced from:
      -[GCK_GCDAsyncSocket cf_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLAllowsAnyRoot", referenced from:
      -[GCK_GCDAsyncSocket maybeStartTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLAllowsExpiredCertificates", referenced from:
      -[GCK_GCDAsyncSocket maybeStartTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLAllowsExpiredRoots", referenced from:
      -[GCK_GCDAsyncSocket maybeStartTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLCertificates", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLIsServer", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLLevel", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLPeerName", referenced from:
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
  "_kCFStreamSSLValidatesCertificateChain", referenced from:
      -[GCK_GCDAsyncSocket maybeStartTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCKCastSocket connectToHost:port:withTimeout:] in GoogleCast(GCKCastSocket.o)
      -[GCK_GCDAsyncSocket maybeStartTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCK_GCDAsyncSocket ssl_startTLS] in GoogleCast(GCKAsyncSocketWrapper.o)
      -[GCKCastSocket connectToHost:port:withTimeout:] in GoogleCast(GCKCastSocket.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any ideas?


Solution

  • You need to link against the Security.framework and the CFNetwork.framework.

    Xcode > Your Project > Build Phases > Link Binary with Libraries > + > Security.framework