The thing is, a war with China would be a much easier and simpler affair than a war with Iran. It would be comparable to the Falklands War - a limited engagement where the two sides fight only in a restricted theatre of war (Taiwan) using conventional weapons, and leaving the mainland out of it. Nobody would be talking about invading the US or China, and nobody would be thinking about using nuclear weapons in the event of defeat. So, while politically unlikely, such a war is militarily feasible and winnable for both sides.
Iran is a different story. There's no possible middle-ground scenarios - you can't very well strike Iran's nuclear reactor without expecting reprisals in both Iraq and Afghanistan, so it's all or nothing. A war with Iran would essentially mean a full-scale invasion and occupation, and that's entirely out of America's reach. The US doesn't currently have enough forces... it does not even have the capability to raise an army big enough to invade Iran. They'd have to bring back the draft and spend a year or two preparing for war. We're talking about invasion on a country almost five times the size of Germany (and you know how many millions of troops that required), a country that has roughly 30 million people fit for military service, and - most important of all - a government that has the full and total support of its citizens (even those politically opposed to the government would support it in war). The US would simply have no chance of winning the war against Iran, and they have no intention of getting into such a war - as you can tell from the fact that the US government is talking about reducing their already insignificant presence in Iraq, rather than increasing it in preparation for another conflict.
(don't get me wrong - technologically, the US is hugely superior to Iran. But quality isn't everything - quantity also counts, especially when you're trying to capture and occupy a mountainous area of that size)