Please tell me what is the default map location when it simply add to the view.
I added mapview like this
MKMapView *mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, self.searchBar.frame.size.height, 320, 180)];
mapView.mapType=MKMapTypeStandard;
mapView.delegate=self;
[self.view addSubview:mapView];
what location will show on map ?
Is this according to device coordinates or by other
Thanks
After done so googling and reading apple map doc.
I found the solution the default location is the device local that is International in Settings -> general ->International->ResionFormat-> select your country.
map will focus according to this setting.
I think the system makes a call and Apple's servers return this info.
I've made a little test with simulator (Extra info: I'm in Spain):
Test 1
Turn off internet access
iOS simulator > Reset content and settings
Build and run app w/mapview
Turn on internet access
Little scroll on map (just for change region a little and begin with map tiles downloading)
United states is being displayed on screen
Test 2 (wihtout turning off internet)
iOS simulator > Reset content and settings
Build and run app w/mapview
Spain is being displayed on screen
I don't think that Apple's getting user location without consent. It could be a request for default location IP based as a part of operative system.
I'm pretty sure it's lat/long 0, 0 which is somewhere in the ocean above Africa. You see this as a bug in a surprising number of apps which don't set the lat long and you end up seeing a map showing just blue - the sea.
Suggest you just test it!
No answer seems to be correct, at least with iOS8. Apple does not provide documented information on the default region of a mapView, but I believe that MapKit makes a request to the Apple server to get the current country code. In fact, if you try to turn off Internet connection and open a viewcontroller with a simple map just allocated and added as subview to the main view, the debugger will display this message:
Could not determinates current country code: Error Domain = GEOErrorDomain Code = 2 "The operation could not be completed. (GEOErrorDomain error -2.)
There's something unknown that gets the current country code and shows that country as initial region in a mapview. This "current country code" is not related with the user location, as the message is also shown by disabling location services (unless Apple takes the user's location without user authorization, which is impossible). Maybe it uses the IP address of the Internet connection to make IP tracert. I will try to use a proxy to verify.
Related
I am developing an AppClip that detects the user's physical location to display the app clip. Apple mentioned a piece of code here:
func location(from url:URL) -> CLRegion? {
let coordinates = CLLocationCoordinate2D(latitude: 37.334722,
longitude: 122.008889)
return CLCircularRegion(center: coordinates,
radius: 100,
identifier: "Apple Park")
}
My question is, is it possible to add multiple locations since my app needs several museums' location to display the AppClip?
Something basic to understand - App Clips are totally not dependant on location services.
More than that - an App Clip doesn't have access to the device location.
The App Clip CANNOT ask 'where am I?'.
The App Clip CAN ask 'Am I at this location?' - just to make sure the QR code for the Boston branch is indeed scanned in Boston.
The experiences are not triggered by location - the only location base for the experiences is a location set in Apple Maps. As you as can spread locations in the Apple Maps for your customers, all of their experiences will show up.
The code you quoted is how to define the radius in which App Clip asks 'Am I in this radius?'
If you define separate QR code for example for each museum:
https://museums.com/nyc/123
https://museums.com/london/356
https://museums.com/paris/789
You should use the URL to understand which radius you should define in the quoted code.
Yes, you can have multiple locations, each with an individual app clip URL. This example code does not in fact extract any info from the app clip URL, as that is highly app-specific.
In a real world scenario, you would have something like
https://example.com/appclip/location/42
as your app clip url, with different IDs for each of your locations.
Your code would then need to figure out the coordinates for location id 42 and use those to check against the user's current location
I have been trying just about every tutorial I can find but I have no luck rendering the google map tiles behind the map in the view. I have double checked google console etc. But I have no luck
As you can see I can get the location to load up correctly, but the actual map behind it doesn't work at all. I have run out of ideas :(
try
check it on real device
double check that API Key of google maps correct and you enable google maps form google console
self.view = mapView in didLayoutSubView Method
I have a very simple application that uses realtime location data to obtain relevant information, developed in C# as a UWP 10.0 application.
My interaction with the geolocation API is very simple: I only checked Location in the "Package Manifest" under "Capabilities" and I only use the following API call:
var locator = new Windows.Devices.Geolocation.Geolocator();
var location = await locator.GetGeopositionAsync();
When this call is first made, Windows 10 throws up an "Allow this application to use your precise location [yes | no]" dialog. Selecting "yes" seems to "save" this choice for around 5 minutes or so; subsequent attempts at obtaining the user's position within the next five minutes go through (I believe they return the cached value, as it never seems to change), but more than 5 minutes later, the permission dialog is always shown once more (even though the user has already authorized it).
From my reading of the geolocation API documentation on MSDN, I can find nothing to suggest that this is the intended behavior. Under privacy settings in the metro control panel, this application is under the list of apps allowed to use the precise location. What's more, other apps in that list with precise location enabled have never prompted me to allow them access to the precise location past the first time.
What am I doing wrong here and how can I prevent this dialog from constantly popping up?
EDIT
With await Geolocator.RequestAccessAsync(), the permissions are cached so long as the exe is not modified/re-compiled.
I was able to replicate your problem. But according to official documentation, it clearly mentions, that you need to call RequestAccessAsync() before any calls.
So when I made change from your lines of codes, to below, permission Request window showed up only once and subsequent calls were made directly.
GeolocationAccessStatus accessStatus = await Geolocator.RequestAccessAsync();
if (accessStatus == GeolocationAccessStatus.Allowed)
{
Geolocator locator = new Geolocator();
Geoposition location = await locator.GetGeopositionAsync();
locText.Text = location.Coordinate.Point.Position.Latitude + Environment.NewLine + location.Coordinate.Point.Position.Longitude;
}
I'm trying to automate the app , but suddenly in middle the google permissions window for permission like phone , location etc pops up , is there any way that I can make sure always permission pop ups are allowed
Try to set desired capabilities:
autoAcceptAlerts = true
Since you said google permissions, I am assuming you are dealing in Android. Also since there is no language tag, I am sticking to Java, you can frame the logic in any language you are using.
Well, its sad to inform you that currently there seems to be no such capability added for android. Though iOS has few similar capabilities.
So, for android what you can do is logically -
If these pop-ups are device dependent, change the device settings that these pop-ups are not allowed.
If these pop-ups are relevant to application permissions, then you must know when they would occur. Just keep a check -
List<WebElement> popUp = driver.findElement(<find the pop up using your locator strategy>);
if(popUp.size()!=0) {
WebElement accept/dismiss = driver.findElement(<find the button accordingly>);
accept/dismiss.click();
}
I've been moving an app over to iOS 7 recently, and whilst the majority is working fine now there's a section of code that calls out to Maps to show directions. The code worked fine under iOS 6, and I can't spot any major changes but I might be missing something, I create a MKMapItem and store it as an instance variable and then retrieve it when the user taps on the annotation view. At that stage Maps does load, and throws the directions not available error.
I encountered this a couple of times. I realised that the MKPlacemark I was using to create the MKMapItem had info in the address dictionary which wasn't matching whatever Apple could lookup.
In the end I didn't use any address information, I used only coordinates and then supplied a name to the MKPlacemark (to appear in the annotation in Maps).