I would like to explain the situation that I am facing. By default iPhone simulator's current location is "loop". I have an application that is being using in south Africa ( for example ). If I test "near me" functionality on simulator. It will show nothing. Similarly If I want to test my application on real device, It will not work for me as I am situated in India. What I have to d开发者_高级运维o is "set current location on simulator". Blackberry simulator & Android simulator/emulator provides - set current location for testing on emulator.
What do you do to come out over this situation ?
On iOS5 Simulator by default you it will show some location in USA. If you want to change that location, in iOS Simulator menu, go to Debug -> Location -> Custom Location. There you can set the latitude and longitude and test the app accordingly. This works with mapkit and also with CLLocationManager.
You have to create your own CLLocation
object with the coordinates for the place you want to test with.
(One way to get the longitude and latitude coordinates is by using Google Maps. Find the place you want to use in Google Maps. Click the "Link"-button. Look in the URL for the "ll"-parameter. This is the longitude and latitude)
Use the coordinate to create your own CLLocation
:
CLLocation *location = [[CLLocation alloc] initWithLatitude:46.47893 longitude:6.35528];
CLLocation
uses CLLocationDegrees
, but that's just a typedef for a regular double
.
Yes its working..
Debug -> Location -> Custom Location
Thanks..
You will have to hardcode with some lat and long in southafrica and set that lat and long as the current location. Then test the app with that hardcoded lat and long
精彩评论