I think we need to also keep things into perspective, there are an estimated 8k homeless in San Francisco, about 1% of its population.
It seems most of those are caused by just poverty, not able to afford living expenses pushed people to the streets.
Some amount of them are coming from other cities who get rid of their homeless by sending them to cities like San Francisco, but Sam Francisco also sometimes send homeless away similarly, this happens all over the US, as a kind of way to spread it out more evenly so it's not as visible in any given place.
The fundamental issues of poverty are hard to solve, obviously, every country, city, nation, has always struggled with this. It's also a little more complicated due to some of the homeless also suffering from mental illness or drug addiction, that doesn't always make them qualified to even work, so it's like poverty mixed with what to do with the people that can't contribute to the work force as effectively.
There's also the case of temperate climate, that's pretty attractive to people who live in the streets, but it's also convenient for a city, if homeless are dying of frost bites or heat, you might feel more compelled to give them shelter, but when outdoor tents suffice you might instead choose to shelter them outside like that and just keep moving them around so they don't stay to the same place too long for the neighbors to complain.
I've heard San Francisco has a policy that when they give shelter, it has to be a full apartment with social service support, whereas New York and other cities go for more warehouse shelters, beds in a big room. The former is nicer to people that get to have access to them, but it hasn't scaled, whereas as the latter isn't as nice but has had more success actually sheltering them and hiding them from view I guess.