Apple has acknowledged that a bug was behind the goof-up which led to iPhone showing Donald Trump's name when user said ‘racist’.