No known class method for selector reachabilityWithHostName

I had a really weird experience recently.

Linker did not link Reachability after I added it as a pod.

In this line compiler was giving error ‘No known class method for selector reachabilityWithHostName:’.

I tried to readd reachability, tried to clean project, nothing helped. Then I just tried to rewrite this line and it compiled!

And now I understand why it worked. Because my old code was taken from another project with other version of Reachability and selector was with ‘HostName’ but new one is with ‘Hostname’.

Before rewriting I was checking if Reachability has this method and it seemed to me that it has and I couldn’t understand the problem. It turned out that I didn’t notice this small change in one letter!

Leave a Reply

Your email address will not be published. Required fields are marked *