In 2015, Iran agreed to a nuclear non-proliferation agreement in exchange for various sanctions to be lifted.
However, an apparently similar agreement was made with North Korea in 1994. President Bill Clinton commented on this:
US Will Be Safer Because of My North Korea Deal
Good afternoon. I am pleased that the United States and North Korea yesterday reached agreement on the text of a framework document on North Korea's nuclear program. This agreement will help to achieve a longstanding and vital American objective: an end to the threat of nuclear proliferation on the Korean Peninsula.
However, that objective was not reached. North Korea did test a nuclear warhead in 2006 and then proceeded with further steps of nuclear proliferation.
How do the contents of these two agreements and the internal and external circumstances of Iran and North-Korea differ to make the JCPOA more likely to be adhered to than the Agreed Framework?