Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No such module error while importing GoogleCast framework in Swift project

Tags:

ios

swift

I am developing an ios application using swift. Downloaded the google cast frame work from the below link mentioned. https://developers.google.com/cast/docs/downloads Added this frame work in the application and imported like this: import GoogleCast But I am getting an error saying that "No Such module Google Cast"

like image 784
user3635384 Avatar asked Oct 31 '22 14:10

user3635384


1 Answers

I got something working in Swift.
I did not need to import anything.

Did you follow instructions from https://developers.google.com/cast/docs/ios_sender

And also configure Objective-C bridging header.
https://developer.apple.com/library/ios/documentation/swift/conceptual/BuildingCocoaApps/MixandMatch.html

I put the location of file GoogleCast.h here

enter image description here

I tested 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 an Iphone 5s from Xcode and it found my ChromeCast device:

device found - AW

like image 178
August Avatar answered Nov 15 '22 05:11

August