The Cast framework supports iOS 12 and later, and comes in both static and dynamic frameworks.
See the Google Cast iOS API Reference for descriptions of all classes and methods.
Note that newer generation Cast devices support guest mode for iOS but older generation devices do not. For details, see Guest Mode - Supported Cast Devices.
- Add the Cast iOS SDK 4.7.0 to your project
If using Cocoapods, use
pod updateto add the 4.7.0 SDK to your project.
Otherwise, pull in the SDK manually.
Info.plistto allow local network discovery to succeed on iOS 14.
You will need to add both
_<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
Update the following example
NSBonjourServicesdefinition and replace "ABCD1234" with your appID.
We 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 the
NSLocalNetworkUsageDescriptionsuch 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.7.0 as soon as possible.
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.
The recommended way of integrating Google Cast is using the
google-cast-sdk CocoaPods or the
google-cast-sdk-no-bluetooth CocoaPods if your app does not require the
guest mode or you do not wish to require Bluetooth®
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 is an example of the
google-cast-sdk Cocoapod in a Podfile:
use_frameworks! platform :ios, '12.0' def target_pods pod 'google-cast-sdk' end target 'CastVideos-objc' do target_pods end target 'CastVideos-swift' do target_pods end
Here is an example of the
google-cast-sdk-no-bluetooth Cocoapod in a Podfile:
use_frameworks! platform :ios, '12.0' def target_pods pod 'google-cast-sdk-no-bluetooth' 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 example, version 4.7.0 and the versions up to 5.0 are allowed, not including 5.0 and higher:
pod 'google-cast-sdk', '~> 4.7.0'
The following instructions are for manually adding the framework to your project.
Libraries without guest mode have been provided for situations where your app does not require the feature or you do not wish to require Bluetooth® permissions, which have been introduced in iOS 13. Please see the iOS 13 Changes document for more information.
Download the Cast 4.7.0 iOS Sender API libraries:
GoogleCast.framework in your project, and select Show In Finder.
into the top-level directory of your Xcode project. When prompted, ensure Copy items into
destination group's folder is NOT selected.
In your Xcode project, set the Other Linker Flags in Build Settings to:
In your Xcode project, open the Build Phases tab for your application’s target, add the following frameworks within Link Binary with Libraries:
The libraries appear in your project as follows:
Next, add the
GoogleCast.framework to Frameworks, Libraries, and Embedded
Content section of the General tab. Keep the embed option as "Do Not
Embed" for static framework and "Embed & Sign" for dynamic framework.
Ensure that the Runpath Search Paths setting of the Build Settings in the project's settings is set to "@executable_path/Frameworks".
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.
Publishing your app to App Store
Before publishing your app to the App Store, you need to run shell script
strip_unused_archs.sh to strip unused architectures from the app bundle.
This script is in the Cast SDK for iOS.