Fix deprecation warning for iOS 6 and above