Apple CEO Tim Cook says a global memory chip shortage is beginning to bite, with rising costs expected to pressure margins ahead.