AI-generated Key Takeaways
-
The Cast framework supports iOS 15 and later and is available in static and dynamic frameworks.
-
Using
-Ofastfor the Optimization Level flag in Xcode will cause the Cast iOS SDK to crash; the SDK supports the default value-Os. -
For iOS 14, you must add
NSBonjourServicesandNSLocalNetworkUsageDescriptionto yourInfo.plistfile for device discovery to work correctly. -
Adding the Cast iOS SDK can be done using CocoaPods or by manually adding the framework to your project.
The Cast framework supports iOS 15 and later, and comes in both static and dynamic frameworks.
See the Google Cast iOS API Reference for descriptions of all classes and methods.
Xcode setup
iOS 14
-
Add the Cast iOS SDK 4.8.4 to your project
If using CocoaPods, use
pod updateto add the 4.8.4 SDK to your project.Otherwise, pull in the SDK manually.
-
Add
NSBonjourServicesto yourInfo.plistSpecify
NSBonjourServicesin yourInfo.plistto allow local network discovery to succeed on iOS 14.You will need to add both
_googlecast._tcpand_<your-app-id>._googlecast._tcpas services for device discovery to work properly.The appID is your receiverID, which is the same ID that is defined in your
GCKDiscoveryCriteria.Update the following example
NSBonjourServicesdefinition and replace "ABCD1234" with your appID. -
Add
NSLocalNetworkUsageDescriptionto yourInfo.plistWe strongly recommend that you customize the message shown in the Local Network prompt by adding an app-specific permission string in your app's
Info.plistfile for theNSLocalNetworkUsageDescriptionsuch as to describe Cast discovery and other discovery services, like DIAL.This message will appear as part of the iOS Local Network Access dialog as shown in the mock.
-
Re-release your app to the Apple App Store
We recommend you also re-release your app using 4.8.4 as soon as possible.
iOS 13
iOS 12
Ensure that the Access WiFi Information switch in the Capabilities section of the target is set to "On".

Additionally, your provisioning profile will need to support the Access WiFi Information capability. This can be added in the Apple Developer Portal.

CocoaPods setup
The recommended way of integrating Google Cast is using
CocoaPods. For integration, use the
google-cast-sdk CocoaPods.
To get started, follow the getting started guide.
Once CocoaPods is set up, follow the
using CocoaPods guide
to get your Podfile created and your project ready to use with the Google Cast
SDK.
Here's an example of how to add the google-cast-sdk CocoaPod to your
Podfile:
use_frameworks!
platform :ios, '15.0'
def target_pods
pod 'google-cast-sdk'
end
target 'CastVideos-objc' do
target_pods
end
target 'CastVideos-swift' do
target_pods
end
For your project, you should specify a range for your pods to prevent unexpected breaking changes as detailed in the podfile guide.
In this snippet, version 4.8.4 and the versions up to the next major version (major.minor.patch) are allowed:
pod 'google-cast-sdk', '~> 4.8.4'
For example, '~> 1.6.7' would include all versions from 1.6.7 and up to, but not including, version 2.0.0.
Manual setup
The following instructions are for adding the Cast iOS SDK to your project without using CocoaPods:
Downloads
After downloading the appropriate library below, follow the setup steps to add the framework to your project.
Cast iOS Sender SDK 4.8.4 libraries:
Setup steps
To install the library:
- Download and extract the appropriate SDK for your project.
- Set up the dynamic GoogleCastSDK library:
-
Drag the unzipped
.xcframeworkinto your main project in the Xcode project navigator (not into the Pods project if you have one). Check 'Copy all items if needed', and add to all targets. -
In your Xcode target, under the
Generaltab, selectEmbed and SignforGoogleCast.xcframework.
If you are setting up the dynamic library, follow these steps in addition to the previous steps:
- Set up the Protobuf library with minimum version v3.13.
- If your project uses CocoaPods:
-
Open your
Podfileand remove thegoogle-cast-sdkif present:pod 'google-cast-sdk'
-
Add the
Protobuflibrary if not present:pod 'Protobuf', '3.13'
-
Run
pod installin the root folder of your project. - If your project is not using CocoaPods:
-
Remove the current version of
GoogleCastSDKif present. - Add the Protobuf library v3.13 or greater, following the instructions found on the Protobuf GitHub repo.
If you are setting up the static library, follow these steps in addition to the previous steps:
-
In your Xcode project, add the flags
-ObjC -lc++to Build Settings > Other Linker Flags.
-
Locate the Resources folder in the unzipped directory and
drag all of the
.bundlefiles into the your project next to theGoogleCast.xcframeworkyou added previously. Check 'Copy all items if needed', and add to all targets.
Mac Catalyst setup
For Apps that support Mac Catalyst, use the dynamic library of the Cast SDK. Follow the manual setup process to add the framework to your project. Then conditionally exclude the Cast SDK from the Mac target as mentioned in the Apple documentation. Static libraries are pre-compiled for iOS architecture, which causes a linker error when building against the Mac target.