Djuro
Djuro

Reputation: 31

GCKDiscoveryManager not founding Chromecast devices iOS SDK

I'm trying to find Chromecast devices with my iOS App.

I've downloaded cast SDK via CocoaPods, and then I try the following:

let gckCastOptions = GCKCastOptions(receiverApplicationID: kGoogleCastAppReceiverId)
        GCKCastContext.setSharedInstanceWithOptions(gckCastOptions)
        GCKLogger.sharedInstance().delegate = self

        self.discoveryManager = GCKCastContext.sharedInstance().discoveryManager
        self.discoveryManager!.addListener(self)
        self.discoveryManager!.passiveScan = true
        self.discoveryManager!.startDiscovery()

And then, in the listener method:

func didStartDiscoveryForDeviceCategory(deviceCategory: String) {
        print("GCKDiscoveryManagerListener: \(deviceCategory)")

        print("FOUND: \(self.discoveryManager!.hasDiscoveredDevices)")
    }

Result is always false :(

On my Mac, when I open YouTube, I can stream video to Chromecast device, so device is set definitely.

I am testing on simulator? Should I try it on real device? I suppose that this is not necessary since I'm only trying to discover the available devices.

I've tried to add GCKDeviceScanner too, no luck. I suppose that this is the starting point.

Tried to add GCKUICastButton via storyboard - not being able to do it :(

Upvotes: 3

Views: 2930

Answers (2)

Naveen
Naveen

Reputation: 9

Have a look in this setting. Go to project capabilities

enter image description here

Go to project setting and select device capabilities. select this option as discussed in image

Upvotes: 0

Alejandro Luengo
Alejandro Luengo

Reputation: 1364

Have a look to this setting. As soon as I enabled it it started working

enter image description here

Also, please make sure you set another kReceiverAppID other than the given example (AABBCCDD), for example we are using the one listed on the example app, for example static NSString *const kReceiverAppID = @"4F8B3483" (I guess you need to make your own at Google Play Developer Console)

And finally, you can be pretty sure it will never work on a simulator, you need REAL device for this.

Upvotes: 1

Related Questions