Add conditions to fix compilers errors under iOS 6 sdk