Replace deprecated APIs with new ones

:boom: Do NOT merge :boom:

This PR mainly replaces all APIs which have been deprecated due to Mac OS X 10.6 with new ones.