Fix deprecation warnings in iOS 8