The company pulled in $40.67 billion in second-quarter iPhone revenue, beating expectations for $38.59 billion.