The company reported higher-than-expected iPhone sales, though they declined for the second straight quarter.