> Having visited Iran by myself and having had the pleasure of being invited to join strangers in several cities to meet their friends and join them for meals at their homes, I found this a bit depressing to read.
Oh man, I found your comment depressing to read (though I'm glad you wrote it). It's so frustrating to see one comment like that do so much damage. Ignore the comment you replied to.
For anyone traveling in Iran: with one semi-exception (the case where you have a local translator; see below [1]), if they're are inviting you over, they're really, truly, genuinely happy to have you as a guest. Not only is hospitality just ingrained in the culture (even after taking this stuff into account), but as a foreigner, nobody will think negatively of you in any way for accepting their offer (and this applies even in the case of that caveat [1]). They'll be very delighted for you to say yes. It's really that simple.
The people who need to worry about this already know who they are. (e.g., local relatives/acquaintances who already live in the same community and know they're playing in the same game.) If you have to ask if it applies to you, it doesn't apply to you. End of story.
For more mundane offers about things other than being a guest, you may have to rely more on your common sense and not take initial things at face value, but it's not that complicated, and it'll still be hard to offend people if you miss here unless you're completely clueless. Say, if you go by something and try to pay and they tell you "oh don't worry about it, you're welcome", either they really mean it, or they don't and you should pay anyway (like you would anywhere else on the planet). Though even if you take it literally and walk without paying, they'll figure it was their mistake and not yours. Unless you were buying something ridiculously expensive like a car/jewelry/etc...
[1] The one semi-caveat to this I can think of is if you have a local translator with you. In that case, yes, chances are the offer might not be intended to be taken literally, and they might play the game expecting the translator to play along or convey (or have conveyed) things to you in an intelligible manner. And if the translator fails, they might get a bit turned off by the translator. But in that case, it'd be concerning the translator, not you. And honestly even in that case if the translator has any common sense they will pick up any relevant cues later and relay them to you at some point. (Say, if they invite you over for lunch and then ask you to stay for dinner, the translator will very quickly realize if the dinner offer is sincere or not, and let you know.)