iOS code for location app