A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/cast/docs/ios_sender below:

Setup for Developing With the Cast Application Framework (CAF) for iOS

Skip to main content Setup for Developing With the Cast Application Framework (CAF) for iOS

Stay organized with collections Save and categorize content based on your preferences.

The Cast framework supports iOS 14 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: New versions of the Cast iOS SDK XCFrameworks are now available, which support development on Apple Silicon computers. Xcode setup Warning: Setting the Apple Clang - Code Generation Optimization Level flag to -Ofast for 'Fastest, Aggresive Optimizations' will cause apps using the Cast iOS SDK to crash due to incompatibilities with the optimizations. The SDK supports the default value -Os for 'Fastest, Smallest'. iOS 14 iOS 14 Warning: Changes to iOS 14 local network access permissions have impacted the Google Cast iOS SDK in a number of ways. Please see the iOS 14 Changes document to see how your app is affected.
  1. Add the Cast iOS SDK 4.8.3 to your project

    If using CocoaPods, use pod update to add the 4.8.3 SDK to your project.

    Otherwise, pull in the SDK manually.

    Note: If you built a custom device picker in your app, then you will need to explicitly call the startDiscovery method on the GCKDiscoveryManager class to initiate device discovery. Automatic scanning was disabled by default beginning with the v4.5.0 release of the Cast SDK.
  2. Add NSBonjourServices to your Info.plist

    Specify NSBonjourServices in your Info.plist to allow local network discovery to succeed on iOS 14.

    You will need to add both _googlecast._tcp and _<your-app-id>._googlecast._tcp as 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 NSBonjourServices definition and replace "ABCD1234" with your appID.

    <key>NSBonjourServices</key>
    <array>
      <string>_googlecast._tcp</string>
      <string>_ABCD1234._googlecast._tcp</string>
    </array>
  3. Add NSLocalNetworkUsageDescription to your Info.plist

    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.plist file for the NSLocalNetworkUsageDescription such as to describe Cast discovery and other discovery services, like DIAL.

    <key>NSLocalNetworkUsageDescription</key>
    <string>${PRODUCT_NAME} uses the local network to discover Cast-enabled devices on your WiFi
    network.</string>

    This message will appear as part of the iOS Local Network Access dialog as shown in the mock.

  4. Re-release your app to the Apple App Store

    We recommend you also re-release your app using 4.8.3 as soon as possible.

iOS 13 iOS 13 Warning: Apple permissions changes to iOS 13 and Xcode 11 have impacted the Google Cast iOS SDK in a number of ways. Please see the iOS 13 Changes document to see how your app will be impacted. iOS 12 iOS 12 Warning: If developing using Xcode 10, the "Access WiFi Information" capability is required in order to discover and connect to 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.

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, '14.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.3 and the versions up to the next major version (major.minor.patch) are allowed:

pod 'google-cast-sdk', '~> 4.8.3'

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:

Key Point: Starting with version 4.3.1, CocoaPods uses static libraries to avoid duplicate symbol warnings caused by a shared Protobuf library dependency when using the Firebase and Cast SDKs together. Although this change will result in a larger download, the final app size will not increase.

If the size difference is a concern for your situation, download the dynamic library to get a size similar to pre-4.3.1 versions of the CocoaPods library.

Downloads

After downloading the appropriate library below, follow the setup steps to add the framework to your project.

Cast iOS Sender SDK 4.8.3 libraries:

Static Dynamic

Setup steps

To install the library:

  1. Download and extract the appropriate SDK for your project.
  2. Set up the dynamic GoogleCastSDK library:
  3. Drag the unzipped .xcframework into 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.
  4. In your Xcode target, under the General tab, select Embed and Sign for GoogleCast.xcframework.

If you are setting up the static library, follow these steps in addition to the previous steps:

  1. Set up the Protobuf library with minimum version v3.13.
    1. If your project uses CocoaPods:
      1. Open your Podfile and remove the google-cast-sdk if present:
        pod 'google-cast-sdk'
      2. Add the Protobuf library if not present:
        pod 'Protobuf', '3.13'
      3. Run pod install in the root folder of your project.
    2. If your project is not using CocoaPods:
      1. Remove the current version of GoogleCastSDK if present.
      2. Add the Protobuf library v3.13 or greater, following the instructions found on the Protobuf GitHub repo.
  2. In your Xcode project, add the flags -ObjC -lc++ to Build Settings > Other Linker Flags.
  3. Locate the Resources folder in the unzipped directory and drag GoogleCastCoreResources.bundle, GoogleCastUIResources.bundle and MaterialDialogs.bundle into the your project next to the GoogleCast.xcframework you 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.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-05-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-07 UTC."],[[["The Cast framework supports iOS 14 and later and is available in static and dynamic frameworks with new XCFrameworks supporting Apple Silicon."],["Google Cast is best integrated using CocoaPods, with manual setup as an alternative involving static or dynamic libraries."],["iOS 14 introduces local network permission changes requiring `NSBonjourServices` and `NSLocalNetworkUsageDescription` in your app's `Info.plist`."],["Re-release your app with Cast iOS SDK 4.8.3 to address iOS 14 network permission requirements for optimal functionality."],["Xcode optimization level should be set to the default `-Os`, as `-Ofast` causes crashes with the Cast iOS SDK."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3