Apple Inc. allegedly hid the effects of replacement iPhone batteries and the U.S.-China trade war on demand for its smartphones, a May 14 investor suit said.

The technology firm didn’t tell investors that discounted battery replacements—introduced after customers found out Apple was intentionally decreasing battery performance in older iPhone models—were slowing demand for new smartphones, the would-be class complaint filed in the U.S. District Court for the Northern District of California said.

Apple also misled investors about how the current...