South Africa grabbed international attention earlier this year with images of angry demonstrators attacking foreign residents and their businesses. This type of xenophobic violence, analysts say, is largely driven by high unemployment, inequality and frustration with the government’s failure to provide everyone with basic services. But like those enduring challenges, xenophobic attacks are also proving hard…