Xinhua, the state news agency, has more or less asked Mr. Trump to shut up. “An obsession with ‘Twitter foreign policy’ is undesirable,” read the headline of a Xinhua commentary on Tuesday about Mr. Trump’s posts.

“Everyone recognizes the common sense that foreign policy isn’t child’s play, and even less is it like doing business deals,” said the article, published after Mr. Trump’s latest barbed comments on China.

“Twitter shouldn’t become an instrument of foreign policy,” the article said. Earlier that day, a spokesman for the Ministry of Foreign Affairs rejected Mr. Trump’s accusation that Beijing had coddled North Korea.

But the article acknowledged that it was probably too late to detach Mr. Trump from Twitter. Mr. Trump’s designated press secretary, Sean Spicer, has indicated that Mr. Trump will keep using the terse, punchy format after he settles in the White House.

“Issuing tweets has become a habit for Mr. Trump,” Xinhua noted. Mr. Trump, it said, appeared to assume that “issuing hard-line comments and taking up sensitive issues may perhaps add to his chips for negotiating with other countries.”