The Cast framework supports iOS 9 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.
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 Cocoapod or the
google-cast-sdk-no-bluetooth Cocoapod 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, '9.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, '9.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.4 and the versions up to 5.0 are allowed, not including 5.0 and higher:
pod 'google-cast-sdk', '~> 4.4'
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.4.7 iOS Sender API libraries:
In your Xcode project, set the Other Linker Flags in Build Settings to:
In your Xcode project, add the following framework libraries (linked, not embedded):
The libraries appear in your project as follows:
Next, add the GoogleCast.framework to the Embedded Binaries section of the General tab in the target's settings. Do not remove GoogleCast.framework from the Linked Frameworks and Libraries section; it must still be in there as well.
Ensure that the Runpath Search Paths setting of the Build Settings in the project's settings is set to "@executable_path/Frameworks".
Ensure that the settings in the Embed Frameworks section of Build Phases lists the GoogleCast.framework.
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.