There is no such module error when importing GoogleCast frames in a Swift project

I am developing an ios application using swift. We downloaded the work of the Google personnel frame from the link below. https://developers.google.com/cast/docs/downloads Added this frame work in the application and imported as follows: import GoogleCast But I get the error message "There is no such Google Cast module"

+5
source share
2 answers

Something works for me in Swift. I did not need to import anything.

You followed the instructions from https://developers.google.com/cast/docs/ios_sender

Also configure the Objective-C bridge title.
https://developer.apple.com/library/ios/documentation/swift/conceptual/BuildingCocoaApps/MixandMatch.html

I posted the GoogleCast.h file GoogleCast.h

enter image description here

I checked this sample code:

  class ViewController: UIViewController, GCKDeviceScannerListener { var scanner = GCKDeviceScanner()!; func deviceDidComeOnline(device: GCKDevice!) { println("device found - \(device.friendlyName)"); } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. //scanner = GCKDeviceScanner(); println(scanner) scanner.addListener(self) scanner.startScan() } } 

I run this on Iphone 5s from Xcode and it found my ChromeCast device:

device found - AW

+2
source

Here's how I worked on my Swift project (after the Google Cast for iOS tutorial):

  • I downloaded the Google Cast iOS Sender SDK and I pasted it into the project root folder
  • I set Other linker flags in Build Settings : -ObjC -lc++
  • I added the following library libraries (linked, not embedded):

    • Accelerate.framework
    • AudioToolbox.framework
    • AVFoundation.framework
    • CoreBluetooth.framework
    • CoreGraphics.framework
    • CoreText.framework
    • Foundation.framework
    • MediaAccessibility.framework
    • MediaPlayer.framework
    • MediaToolbox.framework
    • QuartzCore.framework
    • SystemConfiguration.framework
    • UIKit.framework
  • Still in the libraries of related libraries, I added GoogleCast.framework click + → Add another ... → GoogleCast.framework

  • I added a new entry in the Assembling Phases section of the Assembling Phases section. I chose Add Other GoogleCast.framework -> Resources -> GoogleCastResources.bundle

I have not added any Objective-C bridge headers and it works great!

0
source

Source: https://habr.com/ru/post/1206317/


All Articles