Apple CEO Tim Cook attributed slower sales in China in part to the devaluation of the yuan.