Trump’s visit to China is seen as an opportunity to build on a fragile trade truce, but it has become tangled in his effort to find an endgame to the war in Iran.