SAN FRANCISCO — Have consumers lost their affection for Apple gadgets, or are they just waiting for the new iPhones to come out in September?

Every one of Apple’s major hardware businesses posted declines in the three months that ended in June, the company reported on Tuesday.

It was the second quarter in a row of falling sales as the technology giant wrestles with a saturated market and a slow shift to services, not gear, as a major driver of the company’s profits. Over all, the company posted revenue of $42.4 billion, down 15 percent compared with the same quarter last year.

The quarter that ended in March was the first time in 13 years that revenue at Apple, which has spent much of the last five years as the world’s most valuable company, was lower than in the same period a year earlier.