Apple’s Tim Cook is the corporate world’s top diplomat. The 58-year-old chief executive can criticise President Donald Trump’s treatment of migrants as “inhumane”, denounce his tolerance of white supremacists — and still be invited for cordial talks at the White House.

It shows immense skill to present a socially progressive worldview, directly oppose Mr Trump’s rhetoric and still remain in the good graces of the thin-skinned president.

Overseas, too, Mr Cook’s deft political touch is evident. In China, while most of US big tech is barred by Beijing, Mr Cook has turned the country into a $50bn business for Apple, where a fifth of smartphones are iPhones.

But now the diplomatic dance is getting more difficult. This is the year when western business’s love affair with social justice messaging has clashed with its growing dependency on China’s economy. It is hard to pretend to be a touchy-feely humanitarian company while bowing to a country that imprisons innocent Uighurs on a mass scale.

The list of companies that have come up against this conundrum and failed to resolve it satisfactorily is lengthening.

This week alone Activision Blizzard, the video games company, banned a gamer for shouting a slogan in support of the Hong Kong protests. Nike pulled from its stores in China merchandise for the Houston Rockets after the basketball team’s general manager expressed his support for the protesters. They join Starbucks, Marriott, Qantas and Dolce & Gabbana in the line of fire.

The hope was that exposure to western business would accelerate China’s move to a consumerist democracy. Instead, the reverse is happening: the country’s vast business opportunity and totalitarian edge is wearing off on western companies.

As Ben Hunt of Epsilon Theory says: “Do you want to preserve your authenticity and your brand or do you want to preserve your earnings guidance and share price? Choose one. You can’t have both.”

Activision and Nike, with 12 and 14 per cent of their respective sales in China along with most of their growth prospects, chose the share price. Do not expect companies that head a Goldman Sachs league table of China exposure such as Wynn Resorts (75 per cent sales in the country) or Las Vegas Sands (62 per cent) to indulge criticism of Beijing.

Those that do not serve consumers have an easier ride. Semiconductor companies such as Qualcomm (67 per cent of sales from China) or Broadcom (49 per cent) are unlikely to be dragged into unwinnable culture clashes. But who knows? UBS is not a consumer bank but it still landed in trouble when one of its analysts referred (innocently) to Chinese pigs.

For now, Apple is still dancing. An app designed to allow users to track the movements of police in Hong Kong was distributed, pulled, reinstated, then pulled again from its online store.

That last, presumably final, move in the flip-flop came this week after the state-run People’s Daily accused Apple of helping “rioters engage in more violence”. Apple withdrew the app, explaining that it had “been used to target and ambush police . . . and criminals have used it to victimise residents in areas where they know there is no law enforcement”.

The reasoning is at least plausible.

This month, in quarterly earnings, we will see how Apple has weathered the storm in Hong Kong and headwinds from the US-China trade war. Weak sales would be seen as a sign of things to come; a strong performance would only underline the stakes should Apple fall foul of Beijing. The day will come when even Mr Cook’s diplomacy fails.