iOS SDK Version

FBSDKPlacesManager

@interfaceFBSDKPlacesManager:NSObject
FBSDKPlacesManager provides methods for searching for nearby places, as well as for determining the current place where a person might be.
To use some features of the FBSDKPlacesManager, your app must be configured to allow either the CoreLocation permission for kCLAuthorizationStatusAuthorizedWhenInUse, or for kCLAuthorizationStatusAuthorizedAlways. For information about enabling these for your app, see: https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html.
  • Method for generating a graph request for searching the Places Graph using the device’s current location. This is an asynchronous call, due to the need to fetch the current location from the device.

    Declaration

    Objective-C
    -(void)generatePlaceSearchRequestForSearchTerm:(nullableNSString*)searchTermcategories:(nonnullNSArray<NSString*>*)categoriesfields:(nonnullNSArray<NSString*>*)fieldsdistance:(id)distancecursor:(nullableNSString*)cursorcompletion:(nonnullFBSDKPlaceGraphRequestBlock)completion;

    Parameters

    searchTerm
    The term to search for in the Places Graph.
    categories
    The categories for the place. Each string in this array must be a category recognized by the SDK. See FBSDKPlacesKitConstants.h for the categories exposed by the SDK, and see https://developers.facebook.com/docs/places/web/search#categories for the most up to date list.
    fields
    A list of fields that you might want the request to return. See FBSDKPlacesKitConstants.h for the fields exposed by the SDK, and see https://developers.facebook.com/docs/places/fields“ for the most up to date list.
    distance
    The search radius. For an unlimited radius, use 0.
    cursor
    A pagination cursor.
    completion
    An FBSDKPlaceGraphRequestBlock block. Note that this block will return the location, which you can choose to cache and use on calls to the synchronous placesGraphRequestForLocation method.
  • Method for generating a graph request for searching the Places API.

    Declaration

    Objective-C
    -(id)placeSearchRequestForLocation:(id)locationsearchTerm:(nullableNSString*)searchTermcategories:(nonnullNSArray<NSString*>*)categoriesfields:(nonnullNSArray<NSString*>*)fieldsdistance:(id)distancecursor:(nullableNSString*)cursor;

    Parameters

    location
    The location for the search. If you do not wish to provide a location, you must provide a search term.
    searchTerm
    The term to search the Places Graph for.
    categories
    The categories of the place. Each string in this array must be a category recognized by the SDK. See FBSDKPlacesKitConstants.h for the categories exposed by the SDK, and see https://developers.facebook.com/docs/places/web/search#categories for the most up to date list.
    fields
    A list of fields that you might want the request to return. See FBSDKPlacesKitConstants.h for the fields exposed by the SDK, and see https://developers.facebook.com/docs/places/fields for the most up to date list.
    distance
    The search radius. For an unlimited radius, use 0.
    cursor
    A pagination cursor

    Return Value

    An FBSDKGraphRequest for the given parameters.
  • Method for generating a graph request to query for places the device is likely located in. This is an asynchronous call, due to the need to fetch the current location from the device. Note that the results of the graph request are improved if the user has both Wi-Fi and Bluetooth enabled.

    Declaration

    Objective-C
    -(void)generateCurrentPlaceRequestWithMinimumConfidenceLevel:(FBSDKPlaceLocationConfidence)minimumConfidencefields:(nonnullNSArray<NSString*>*)fieldscompletion:(nonnullFBSDKCurrentPlaceGraphRequestBlock)completion;

    Parameters

    minimumConfidence
    The Minimum Confidence level place estimate candidates must meet.
    fields
    A list of fields that you might want the request to return. See FBSDKPlacesKitConstants.h for the fields exposed by the SDK, and see https://developers.facebook.com/docs/places/fields for the most up to date list.
    completion
    A FBSDKCurrentPlaceGraphRequestBlock block, that contains the graph request.
  • Method for generating a graph request to query for places the device is likely located in. This method allows the user to pass in a CLLocation, as the above method can be real-world slow at obtaining a location from device (on the order of multiple seconds). This is still an asynchronous call, as the bluetooth scan still needs to happen, however it is relatively fast (0.5 seconds). Note that the results of the graph request are improved if the user has both Wi-Fi and Bluetooth enabled.

    Declaration

    Objective-C
    -(void)generateCurrentPlaceRequestForCurrentLocation:(id)currentLocationwithMinimumConfidenceLevel:(FBSDKPlaceLocationConfidence)minimumConfidencefields:(nonnullNSArray<NSString*>*)fieldscompletion:(nonnullFBSDKCurrentPlaceGraphRequestBlock)completion;

    Parameters

    currentLocation
    The current location of the device. If the location passed in here isn’t actually the current location, accuracy of results will be diminished.
    minimumConfidence
    The Minimum Confidence level place estimate candidates must meet.
    fields
    A list of fields that you might want the request to return. See FBSDKPlacesKitConstants.h for the fields exposed by the SDK, and see https://developers.facebook.com/docs/places/fields for the most up to date list.
    completion
    A FBSDKCurrentPlaceGraphRequestBlock block, that contains the graph request.
  • Method for generating a graph request to provide feedback to the Places Graph about the accuracy of current place estimate candidates. We’d very much appreciate it if you’d give us feedback about our current place results. If a user indicates that a place returned by a current place estimate either is, or is not where they currently are, then this method generates a graph request to allow you to pass that feedback back to us.

    Declaration

    Objective-C
    -(id)currentPlaceFeedbackRequestForPlaceID:(nonnullNSString*)placeIDtracking:(nonnullNSString*)trackingwasHere:(BOOL)wasHere;

    Parameters

    placeID
    The place ID returned by the current place request.
    tracking
    The tracking value returned by the current place request.
    wasHere
    A boolean value indicating whether the user is actually at the place.

    Return Value

    An FBSDKGraphRequest for the given parameters.
  • Method for generating a graph request to fetch additional information for a given place.

    Declaration

    Objective-C
    -(id)placeInfoRequestForPlaceID:(nonnullNSString*)placeIDfields:(nonnullNSArray<NSString*>*)fields;

    Parameters

    placeID
    The ID of the place.
    fields
    A list of fields that you might want the request to return. See FBSDKPlacesKitConstants.h for the fields exposed by the SDK, and see https://developers.facebook.com/docs/places/fields for the most up to date list.

    Return Value

    An FBSDKGraphRequest for the given parameters.