Lack of affordable housing may be an issue, but there is a lot of opposition to a very simple solution to that. Assist the homeless in moving to a location with cheap housing. Not everyone has a right to live in the expensive area of San Francisco. If someone can't pay for housing, we don't want to forsake those people. But giving them cheap housing in a very desirable place is hard.
Unfortunately, the issue with that is that there will still be people who would prefer to live in the expensive city, even if they don't have a house.
But no state has enough affordable housing. Some states have a bigger shortage than others, but all states lack sufficient amounts of affordable housing.