---
title: "purgeObjectsAndRecordsInZoneWithID:inPersistentStore:completion:"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nspersistentcloudkitcontainer/purgeobjectsandrecordsinzonewithid:inpersistentstore:completion:"
---

# purgeObjectsAndRecordsInZoneWithID:inPersistentStore:completion:

Deletes all CloudKit records in the specified record zone, along with their corresponding managed objects.

## Declaration

```occ
- (void) purgeObjectsAndRecordsInZoneWithID:(CKRecordZoneID *) zoneID inPersistentStore:(NSPersistentStore *) persistentStore completion:(void (^)(CKRecordZoneID *purgedZoneID, NSError *purgeError)) completion;
```

## Parameters

- `zoneID`: The ID of the record zone to purge.
- `persistentStore`: The persistent store that manages the CloudKit database containing the record zone. Use nil to attempt the purge in each of the container’s persistent stores that manages a CloudKit database.
- `completion`: The handler to invoke after Core Data purges the CloudKit records and managed objects.

## Discussion

Discussion The completion callback returns no value and takes the following parameters: The ID of the purged record zone, or nil if the purge fails. An error object that contains information about a problem, or nil if Core Data successfully purges the record zone. If persistentStore is nil, the method invokes the completion handler once for each of the persistent container’s stores that manages a CloudKit database.
