<br />

> [!NOTE]
> This feature requires that you enable Places API (New), the next generation of the Places API. For more information, see [Enable APIs](https://developers.google.com/maps/documentation/places/ios-sdk/legacy/cloud-setup#enabling-apis).

<br />

Places SDK for iOS (Legacy) supports
[Place Photos (Legacy)](https://developers.google.com/maps/documentation/places/ios-sdk/photos).
If you are familiar with Place Photos (Legacy),
[Place Photos (New)](https://developers.google.com/maps/documentation/places/ios-sdk/place-photos.md.txt)
makes the following changes:

- Uses a new pricing model. For pricing information for all APIs, see
  [Usage and billing](https://developers.google.com/maps/documentation/places/ios-sdk/usage-and-billing.md.txt#pricing-new).

- Place Photos (Legacy) supported a maximum photo
  size of 1600 by 1600 pixels. Place Photos (New)
  supports sizes up to 4800 by 4800 pixels.

- To make a request, call the new [`GMSPlacesClient
  fetchPhotoWithRequest:callback:`](https://developers.google.com/maps/documentation/places/ios-sdk/legacy/reference/objc/Classes/GMSPlacesClient#-fetchphotowithrequest:callback:)
  method.

- Pass to the request:

  - An instance of the new
    [`GMSFetchPhotoRequest`](https://developers.google.com/maps/documentation/places/ios-sdk/legacy/reference/objc/Classes/GMSFetchPhotoRequest)
    class that defines all request parameters, including the max image size.

  - A callback of type
    [`GMSPlacePhotoMetadataResultCallback`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions.md.txt#/c:GMSPlacesClient.h@T@GMSPlacePhotoMetadataResultCallback)
    to handle the response.

- Each photo is represented by a
  [`GMSPlacePhotoMetadata`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacePhotoMetadata.md.txt)
  instance. For Places SDK for iOS (New) the `GMSPlacePhotoMetadata`
  instance contains a new
  [`authorAttribution`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacePhotoMetadata.md.txt#authorattributions)
  field represented by the new
  [`GMSPlaceAuthorAttribution`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceAuthorAttribution.md.txt)
  class.

  If the returned `GMSPlacePhotoMetadata` instance includes
  [`attributions`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacePhotoMetadata.md.txt#attributions)
  or `authorAttribution`, you must include these attributions in your
  application wherever you display the image. See the documentation on
  [attributions](https://developers.google.com/maps/documentation/places/ios-sdk/policies.md.txt#other_attribution_requirements).

## Example request

The following example method takes a place ID and gets the first photo in the
returned list. You can use this method as a template for the method you will
create in your own app.

### Swift

```swift
// A hotel in Saigon with an attribution.
let placeID = "ChIJV4k8_9UodTERU5KXbkYpSYs"

// Request list of photos for a place
placesClient.lookUpPhotos(forPlaceID: placeID) { (photos, error) in

  guard let photoMetadata: GMSPlacePhotoMetadata = photos?.results[0] else {
    return }

  // Request individual photos in the response list
  let fetchPhotoRequest = GMSFetchPhotoRequest(photoMetadata: photoMetadata, maxSize: CGSizeMake(4800, 4800))
  self.client.fetchPhoto(with: fetchPhotoRequest, callback: {
    (photoImage: UIImage?, error: Error?) in
      guard let photoImage, error == nil else {
        print("Handle photo error: ")
        return }
      print("Display photo Image: ")
    }
  )
}
```

### Objective-C

```objective-c
// A hotel in Saigon with an attribution.
NSString *placeID = @"ChIJV4k8_9UodTERU5KXbkYpSYs";

[placesClient lookUpPhotosForPlaceID:placeID callback: ^(GMSPlacePhotoMetadataList *list, NSError *error) {
  GMSPlacePhotoMetadata *photoMetadata = [list results][0];

  // Request individual photos in the response list
  GMSFetchPhotoRequest *fetchPhotoRequest = [[GMSFetchPhotoRequest alloc] initWithPhotoMetadata:photoMetadata maxSize:CGSizeMake(4800, 4800)];
  [placesClient fetchPhotoWithRequest:fetchPhotoRequest callback: ^(UIImage *_Nullable photoImage, NSError *_Nullable error) {
    if (error == nil) {
      // Display photo
    }
  }];
}];
```