All cities have crime. Many areas of San Francisco are very safe, many areas are not. If you avoid going to unsafe areas, particularly at night, you'll be fine. San Francisco is once of the most dense cities in the US, looking at a map might isn't the best way to determine if a city is unsafe in general. Check out stats like these:
http://en.wikipedia.org/wiki/United_States_cities_by_crime_r...
Also, there are many cities in the Bay Area. Oakland has a high crime rate, but other areas have very little crime.