PhilipsHue / PhilipsHueSDK-iOS-OSX

The Software Development Kit for Philips Hue on iOS and OS X (beta)
579 stars 169 forks source link

Can not connect to Hue bridge after UPnP search #92

Closed rph8 closed 9 years ago

rph8 commented 9 years ago

Hi everyone,

my app searches for Hue bridges on the local network via UPnP (for simplicity's sake, it only uses UPnP, i.e. no portal or IP address search and therefore only finds 1 bridge).

Having selected the bridge with setBridgeToUseWithIpAddress(...) and then enabling the "local heartbeat" with enableLocalConnection(), I get the following error message:

Error occured while fetching inital [sic!] config for full bridge config:
Error Domain=com.philips.hue.sdk Code=21 "Could not connect to the server."
UserInfo=0x1702e0180 {NSUnderlyingError=0x174241470
"Could not connect to the server.",
NSErrorFailingURLStringKey=http://[MAC]/api/[key]/config, 
NSErrorFailingURLKey=http://[MAC]/api/[key]/config, 
_kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=61,
NSLocalizedDescription=Could not connect to the server.}

What is the matter here? I based my code on the XCode sample project, but rewrote it in Swift and separated pure controller logic from View Controller code. I looked for a description of that error message or existing cases, but could not find anything.

rph8 commented 9 years ago

Solved it myself - simple mistake: I confused the IP and the MAC address in the code.