Fixed 5.1.1 compatibility issue

I converted the compilation checks to runtime checks so it can run properly on iOS 5.1.1