Apple is looking to stave off a crisis in China just days before the launch of its next iPhone, an already high-stakes event that will test whether new features can shake the smartphone industry out of the doldrums.

The product unveiling, set to stream globally from the company’s headquarters on Tuesday, risks being overshadowed by multiple controversies in China — Apple’s largest international market. The tech titan is contending with a growing ban on iPhone use among government workers, and a contentious new phone from China’s Huawei Technologies Co. is providing homegrown competition.

But the biggest potential threat to Apple may be something more nebulous: a resurgence in Chinese nationalism that spurs everyday consumers to shun the iPhone and other foreign-branded devices.