Is GPS Spoofing possible in iOS sdk? - iphone

Is there any way in iOS to spoof the GPS location. I mean to say show user different coordinates not the real one ?
Thanks!

As far as i know gps gives you lat long and you show it on map.
What you can do is add your code in between to spoof obviously iam not talking about the default app. Look at heversine formula it will be helpfull
take care of water bodies and buildings you dont want to spoof the position of car in ocean iguess

the most easiest way to do that is make the map annotation you own,
you may look that this https://github.com/samvermette/SVPulsingAnnotationView
hide the original one & make a fake annotation view with any location you want

Related

Driving Directions in the map

I have a view based application and in that I want to show driving directions on map.
I searched for it on google, I got the google maps driving directions api but I didn't got how to use it in program directly webview or is there any other way to use that api programmatically. Any help appreciated.
If you want my advice (and this is the way I do things), use an UIWebView and use a Javascript-based sample to to ask Google to draw directions for you.
It's easy!
Use this link:
http://maps.google.com/maps?f=q&saddr=25.612524,85.128281&daddr=28.574815,77.236545&output=kml
or
http://maps.google.com/maps?f=q&saddr=patna&daddr=new+delhi&output=kml
You can use both web services, one with lat and long ,where second one is with saddr(source address) and daddr(destination address). It gives you xml file parse it and make array of intermediately lat-long points . I think u know how to draw route on MKMapView with the help of Overlay class.
**If you need to finding lat long of given name of location ,use this link:
http://maps.google.co.in/maps?t=h&z=10&hl=en&format=p&q=new+delhi&output=kml
**Keep in mind that ,if location name have two or more then two words then it combines with + operator.
You should take a look at MKMapViewController for displaying maps. Take a look at this tutorial on how to draw routes with MKPolyline.

Selecting a location with MapKit

Is there a best practice or common pattern for allowing users to select a precise location on a map using MapKit?
I've seen examples where a user can enter an address in a search box. But what about the case where a user doesn't know the exact address and wants to select a location from the map?
It's a bit more complex task than it seems.
Here is the guide how to detect single taps on a Web View.
I've used the same pattern to detect single taps on Map View but allowing zooming and dragging at the same time.
Hope it helps.
I would say that replicating the Maps application is close to a best practice for map applications.
You can test it for yourself; tap and hold somewhere on the map and a pin that you can move around by dragging will be dropped where you held your finger.
The Google Maps app seems to tackle what is a reasonable idea by touching the map by instead allowing you to drop a pin on the map; the SO post might help out.

iOS 4.2, looking for a way to manipulate the iPhone 4 camera's focus distance

I am working in an AR project, and we want to manipulate the focusing distance of the iPhone4 camera. Is this even possible? So far, we've found just toggling and auto focusing as options listed here : http://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html%23//apple_ref/occ/instm/AVCaptureDevice/isAdjustingFocus
Thanks in advance for any tips! :)
Regarding the API it seems that the only supported actions are:
- check if AF is supported on the device (iPhones 3GS an 4 only I think)
- enable/disable AF
- set the point-of-interest that is NOT the distance, but only a point in the camera view.
Certainly not what you want to do.
Might be supported in private API... but that would not pass the validation process.
A workaround might be to see how much pixels move as the user shifts slightly, to get a sense of how distant some parts of the image are, and then set the AF point to a region of the image either closer or further based on that.
But, also file a Radar ticket requesting access to specify the focus distance if possible - if enough people ask Apple will add it to the API.

iPhone Direction Arrow?

I need to create an iPhone simple view that, based on the location of the user in the world, points the person to a never-changing Long/Lat location.
Is it possible to know this from the iPhone API?
Any examples?
This is possible on the current (3GS) iPhone, but not on earlier versions (which did not have a compass). The APIs that you'll need to use are in the CoreLocation.framework.
Search the app store for "mecca" and you'll turn up many, many applications that do exactly what you're asking about. You'll also find several applications that let you drop a pin anywhere on the map and have the app point you to it.
I've recently written code that does almost exactly what you describe.
Here's what you ned to do:
Calculate a heading from your current location to your target location. You should use "great circle" calculations, so they show a correct heading even when the destination is over the horizon. I found code (in Javascript) at this link to show me how to do this:
http://www.movable-type.co.uk/scripts/latlong.html
You want the section titled "bearing"
That code uses javascript library routines like "math.sin(x)" You can pretty much just delete the "math." part, and the trig functions work as is.
That will give you your bearing in radians.
You then need to get your compass heading (if on a 3Gs phone), convert it to radians, and use the compass heading to correct for the orientation of the phone. If you're running on a 3G, you can skip the compass heading and show the bearing based on North being at the top of the phone, and let the user orient their phone towards North themselves.
Duncan C

Get Place Location

I need put information about place, where is iPhone now, to UILable in my screen. [Country][City][Street] and maybe coordinates [lat][lng]. For example in my UILable should be:
Your location is German, Berlin, Tiergarten
Can someone show me really simple code how can i get such information that put in my UILable?
The MapKit framework (part of iPhone OS 3.0) provides this for you. Specifically the MKPlacemark object, which you can obtain for a set of co-ordinates using an MKReverseGeocoder.
You need access to a reverse geocoding service, which will take your lat/lon coordinates as input and return some kind of structured address of that location.
Google's is available here: http://code.google.com/apis/maps/documentation/geocoding/index.html#ReverseGeocoding