Mr. McCain was referring to comments Mr. Obama made in San Francisco this month that people in small towns " cling " to guns or religion because they have become bitter about their economic circumstances .