charmingToad
charmingToad

Reputation: 1597

iOS app getting a "device authentication error" when scanning for Chromecast devices

I'm working on an iOS sender app for Chromecast. I have two Chromecast devices set up and was able to detect and connect to both of them until I switched to a different test iPhone, and now when I try to scan for Chromecast devices, the deviceDidComeOnline message is never sent.

I am able to reproduce the problem with the sample app here, with version 2.5.1 of the GoogleCast framework. The following is console output from the sample app when it fails to detect a Chromecast:

2015-01-17 07:52:37.314 CastVideos[411:33216] Start Scan
2015-01-17 07:52:37.315 CastVideos[411:33216] -[GCKDeviceScanner startNetServiceScan]  startNetServiceScan
2015-01-17 07:52:37.341 CastVideos[411:33216] -[GCKNetworkReachability updateStatus]  updateStatus
2015-01-17 07:52:37.345 CastVideos[411:33216] -[GCKDeviceScanner networkReachabilityStatusDidChange:]  networkReachabilityStatusDidChange:1
2015-01-17 07:52:37.345 CastVideos[411:33216] -[GCKDeviceScanner purgeAllOnlineDevices]  purgeAllOnlineDevices
2015-01-17 07:52:37.489 CastVideos[411:33216] -[GCKDeviceScanner startFilteringDevice:]  starting filter for device: <0x1780b0b60:GCKDevice> ChromecastDev2 (be1be9dcbaa4cb82678b977203c3ef91)
2015-01-17 07:52:37.494 CastVideos[411:33216] -[GCKDeviceScanner startFilteringDevice:]  starting filter for device: <0x1700a38a0:GCKDevice> ChromecastDev (3df5a88f22a974661a8a3556acafdd2f)
2015-01-17 07:52:37.629 CastVideos[411:33216] -[GCKCastSecureSocket continueHandshake]  Peer trust certificate invalid; disconnecting
2015-01-17 07:52:37.630 CastVideos[411:33216] -[GCKCastSecureSocket doTeardownWithErrorCode:]  doTeardownWithErrorCode:3
2015-01-17 07:52:37.630 CastVideos[411:33216] __42-[GCKCastSecureSocket initWithBufferSize:]_block_invoke18  Error reading from SSL buffer to stream buffer, status: -50
2015-01-17 07:52:37.630 CastVideos[411:33216] -[GCKCastSecureSocket doTeardownWithErrorCode:]  doTeardownWithErrorCode:1
2015-01-17 07:52:37.631 CastVideos[411:33216] -[GCKDeviceManager castSocket:didDisconnectWithError:]  castSocket:didDisconnectWithError:Error Domain=com.google.GCKError Code=3 "Device authentication failure" UserInfo=0x170272180 {NSLocalizedDescription=Device authentication failure}
2015-01-17 07:52:37.631 CastVideos[411:33216] -[GCKDeviceManager handleConnectionError:]  handleConnectionError error=Error Domain=com.google.GCKError Code=3 "Device authentication failure" UserInfo=0x170272180 {NSLocalizedDescription=Device authentication failure}, _appConnectionState=0
2015-01-17 07:52:37.631 CastVideos[411:33216] -[GCKDeviceManager handleConnectionError:]  giving up on reconnect; _pausedAppID=(null), _wasConnected=0
2015-01-17 07:52:37.632 CastVideos[411:33216] -[GCKDeviceManager unregisterForAppStateNotifications]  unregisterForAppStateNotifications
2015-01-17 07:52:37.634 CastVideos[411:33216] -[GCKDeviceManager disconnectWithError:isExplicit:]  disconnectWithError:(null)
2015-01-17 07:52:37.634 CastVideos[411:33216] -[GCKDeviceScanner filteringFailedForDevice:withError:]  Filter failed for device <0x1700a38a0:GCKDevice> ChromecastDev (3df5a88f22a974661a8a3556acafdd2f) with error Error Domain=com.google.GCKError Code=3 "Device authentication failure" UserInfo=0x170272180 {NSLocalizedDescription=Device authentication failure}
2015-01-17 07:52:37.634 CastVideos[411:33216] -[GCKDeviceScanner filteringFailedForDevice:withError:]  Marking device <0x1700a38a0:GCKDevice> ChromecastDev (3df5a88f22a974661a8a3556acafdd2f) invalid
2015-01-17 07:52:37.635 CastVideos[411:33216] -[GCKDeviceManager unregisterForAppStateNotifications]  unregisterForAppStateNotifications
2015-01-17 07:52:37.635 CastVideos[411:33216] -[GCKDeviceManager disconnectWithError:isExplicit:]  disconnectWithError:(null)
2015-01-17 07:52:37.635 CastVideos[411:33216] -[GCKCastSecureSocket disconnectWithError:]  disconnect

This is happening on an iPhone 6+ running iOS 8.0. When I open other Chromecast compatible apps (Chromecast, YouTube) on this phone, both Chromecast devices are detected successfully. It's just the apps I run from Xcode, and just on this particular test phone, that seem to have this problem.

I've tried the same sample app on several other test devices to see if it had anything to do with the device / OS. Both Chromecast devices are detected without issue on the following iPhones/iPads:

Any idea what would cause this? Thanks in advance.

Upvotes: 1

Views: 4138

Answers (3)

Oliver Needham
Oliver Needham

Reputation: 1

I experienced this when the time and time on the device was incorrect.

When I corrected the date it worked as expected.

Upvotes: 0

Ryan Heitner
Ryan Heitner

Reputation: 13652

It is Possible that the certificate problem was caused by an invalid date on the phone. Check the date time is correct because this could cause the certificate issue and then the Chromecast Issue

Upvotes: 2

charmingToad
charmingToad

Reputation: 1597

Apparently the iPhone I was using had a certificate problem.

Going to Settings->General->Reset->Reset All Settings fixed the problem. At first I tried Reset Network Settings, but that didn't seem to help. Not sure if maybe the combination of both is what did it.

Upvotes: 0

Related Questions