Is there any actual GMSPlace attributions text for testing? - ios

The GMSPlace defines the "attributions" property as: "The data provider attribution string for this place. These are provided as a NSAttributedString, which may contain hyperlinks to the website of each provider." I'm using this in my app, but haven't been able to test this since every place I've looked up does not have any attributions.
My question is: does anyone know of a place I can lookup which includes attributions?

Have you try the code from the example in https://developers.google.com/places/ios-api/attributions#attributions-place?
I have use the code and found a place have the attribution with PlaceID ChIJV4k8_9UodTERU5KXbkYpSYs. I think you can also try and find more from that code.

Related

Get GMSPlace from longitude/latitude coordinates?

I looked at the API here, but it only mentions that you can get the GMSPlace for the user's current location. Is there any way to create my own custom GMSPlace object or get the GMSPlace for the lat/long I want? I looked at previous solutions but didn't find anything.
As per Google's docs:
Represents a particular physical place. A GMSPlace encapsulates
information about a physical location, including its name,
location, and any other information we might have about it. This
class is immutable.
Apparently there is no way to make your own GMSPlace object from the coordinates, nor there' a method that Google's SDK provide.
What I did before, I search for places, the one that Ajay user above discussed.
So the process is:
Get coordinates.
Reversegeocode to get the string address.
Search the string address using the GooglePlaces autocomplete.
From the first result in #3, the placeId is used to get the GMSPlace object using the lookUpPlaceID method.
Beware though that sometimes it returns a wrong address. I've tried it.
GMSPlace is a class provided by Places SDK which provides information about a specific place. You can not create your own custom object.
EDIT: To find a place other than your current location it provides Autocomplete api which automatically return location suggestions while users type.

What is the best way to handle https error codes in iOS?

My goal is to show a source of error to user. For now I'm using NSError localizedDescription string and check if network is reachable.
But sometimes 403, 500... codes appear. I should not display any technical code to user, all error codes must be translated in meaningful english. As I see it, one of the possible solutions is to manually check status code of most popular http errors and provide messages for them.
So my question is, what is the best approach to display http errors to user?
You can display localized description to user. Localized description's core goal is readability so you should use it!
Localized Description :
A string containing the localized description of the error. (read-only)
The object in the user info dictionary for the key NSLocalizedDescriptionKey. If the user info dictionary doesn’t contain a value for NSLocalizedDescriptionKey, a default string is constructed from the domain and code.
So, if there is no value for NSLocalizedDescriptionKey is found then it will return string from domain and code!
So, in this kind of case you can manage your own custom messages! You can set some common standard message also like - server is not responding or unable to complete request etc!!!

Obtaining CNContact from CNContactRelation

I am trying to obtain all related contacts to a selected contact. The way to do this seems to be via mycontact.contactRelations. This gives an array of CNLabeledValue with each of those containing a CNContactRelation as their value. There is then a name property, but it appears nothing else.
The Xamarin documentation for CNContact.ContractRelations seems to suggest I should be able to obtain the corresponding CNContact from a CNContactRelation but I can see no way to do this in objc, other than searching for a contact with a matching name. This may or may not be the contact I'm after, even if they also have a relationship to a contact with the same name as mycontact.
The identifier on the CNLabeledValue seems to refer to the label rather than the related contact, or at least doesn't seem to match the identifier if I select that contact from a CNContactPickerViewController.
Is there a way to obtain the CNContact for the related contact in objc ?
The related names field in Contacts doesn't store linkages, just names. You'll notice this from a user perspective if you go to edit related names in the iOS or OS X Contacts app — it's just a freeform text field. Those apps (and other system apps) will recognize when a related name matches that of another contact (which is why you can ask Siri to call your mother, etc), but they also let you put down names for people you don't have contact info for.
So a CNContactRelation just contains a string, and the only way to find (if there are any) contacts matching a related name is to search the contact store. Use unifiedContactsMatchingPredicate:keysToFetch:error: to search, with a predicate constructed by calling predicateForContactsMatchingName:.

Swift retrieve Place ID from GoogleMaps SDK for iOS

I've got the GPS coordinates of a place and want to query the GoogleMaps SDK for the Place ID in order to get more information about a place.
I looked up the documentation https://developers.google.com/places/place-id. But yet didn't found a way on 'easily' get the Place ID like:
let placeId = GMSService.getPlaceIdFromCoordinates(longitude: 02.52324, latitude: 03.5345)
The iOS documentation for Maps and Places API doesn't list GMSService, the only class resembling is is GMSServices which doesn't have the getPlaceIdFromCoordinates.
You can look at the Place IDs and Details of the Places API documentation. PlaceID can be retrieved from the GMSPlace object.
To actually search for places (whether through text or coordinates) you can try out the Place Autocomplete page of the documentation.

Varying content with CLPlacemark, administrativeArea, iOS6/iOS7

I'm planning to make an app for ios7, and have an issue with the administrativeArea Placemark Attribute.
For iOS6 i get the full name of the administrative area (ex. "California"), but for the iOS7, I get the value of "CA". This is a problem when its so varying. Is there any way I can control this input so its more consistent?
The apple docs doesnt eigher explain this in details..
http://developer.apple.com/library/mac/documentation/CoreLocation/Reference/CLPlacemark_class/Reference/Reference.html#//apple_ref/occ/instp/CLPlacemark/administrativeArea
Thanks!
You can only parse it to uoy needed value.
I can offer you find the list of administrative areas with full name and with little.
After you can add this in 2 .txt files, import them in project,create 2 NSArrays and initialize each array in cycle.
After you can check administrative area name and return right value.

Resources