<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVExternalStorageDevice/nextAvailableURLs(withPathExtensions:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVExternalStorageDevice(im)nextAvailableURLsWithPathExtensions:error:"
  },
  "title" : "nextAvailableURLs(withPathExtensions:)"
}
-->

# nextAvailableURLs(withPathExtensions:)

Generates an array of security scoped URLs that are compliant for digital camera formats, where each element has a different path extension.

```
func nextAvailableURLs(withPathExtensions extensionArray: [String]) throws -> [URL]
```

## Parameters

`extensionArray`

An array of path extensions the method generates URLs for.

## Return Value

An array of digital camera format (DCF) compliant URLs with security scoping, one for each path extension element in `extensionArray`.

## Discussion

The method generates a digital camera format (DCF) compliant URL with security scoping for each file extension element in `extensionArray`. It does this by configuring the folder structure and, if necessary, creates a digital camera image (DCIM) folder on the external storage device.

> Important:
> The method generates an error if ``doc://com.apple.avfoundation/documentation/AVFoundation/AVExternalStorageDevice/authorizationStatus`` isn’t ``doc://com.apple.avfoundation/documentation/AVFoundation/AVAuthorizationStatus/authorized``.

### Request access to the storage device before request

Your app can request authorization before calling the method if [`authorizationStatus`](/documentation/AVFoundation/AVExternalStorageDevice/authorizationStatus) is [`AVAuthorizationStatus.notDetermined`](/documentation/AVFoundation/AVAuthorizationStatus/notDetermined) by calling the [`requestAccess(completionHandler:)`](/documentation/AVFoundation/AVExternalStorageDevice/requestAccess(completionHandler:)) method first.

### Start and stop access to a URL around your code

To access one of the security-scoped URLs the method returns, you need to call the <doc://com.apple.documentation/documentation/Foundation/URL/startAccessingSecurityScopedResource()>, and <doc://com.apple.documentation/documentation/Foundation/URL/stopAccessingSecurityScopedResource()> methods before and after your code.

```objc
[securityScopedURL startAccessingSecurityScopedResource];

// Your code that accesses the URL goes in between the start and stop calls.
...

[securityScopedURL stopAccessingSecurityScopedResource];
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)