Diplomacy requires hard work, but it can work. It can serve the interests of all the parties involved, even if none gets all they want. The Iran nuclear deal met that standard, and now some of the international sanctions imposed on Iran are being lifted. As we learn from this New Yorker piece, the Obama administration ran a second, separate track regarding Americans imprisoned in Iran. This involved Iranian intelligence officials, not the foreign ministry. And it worked. But one of the reasons it worked was that U.S. news organizations voluntarily withheld disclosing the negotiations, as this story reveals.
Negotiations often require secrecy pending their completion. Remember, even the Framers closed the windows and imposed secrecy on the delegates to what became the constitutional convention in Philadelphia in 1787. An agreement should be judged on its totality, not along the way as concessions may be offered or declined.