![]() |
Couchbase Lite
Objective-C API for iOS and Mac OS
|
An unsaved new revision.
Most of its API is inherited from CBLRevisionBase.
Instance Methods | |
| (void) | - setObject:forKeyedSubscript: |
| (nullable CBLSavedRevision *) | - save: |
| Saves the new revision to the database. More... | |
| (nullable CBLSavedRevision *) | - saveAllowingConflict: |
| A special variant of -save: that always adds the revision, even if its parent is not the current revision of the document. More... | |
| (void) | - setAttachmentNamed:withContentType:content: |
| Creates, updates or deletes an attachment. More... | |
| (void) | - setAttachmentNamed:withContentType:contentURL: |
| Creates, updates or deletes an attachment whose body comes from a file. More... | |
| (void) | - removeAttachmentNamed: |
| Removes the attachment with the given name. More... | |
Instance Methods inherited from CBLRevision | |
| (nullable CBLArrayOf(CBLRevision *) | - getRevisionHistory: |
| Returns the ancestry of this revision as an array of CBLRevisions, in chronological order. More... | |
| (nullable id) | - propertyForKey: |
| Shorthand for [self.properties objectForKey: key]. More... | |
| (nullable id) | - objectForKeyedSubscript: |
| Same as -propertyForKey:. More... | |
| () | - CBLArrayOf |
| The names of all attachments (an array of strings). More... | |
| (nullable CBLAttachment *) | - attachmentNamed: |
| Looks up the attachment with the given name (without fetching its contents yet). More... | |
| () | - CBLArrayOf |
| All attachments, as CBLAttachment objects. More... | |
| (instancetype) | - NS_UNAVAILABLE |
Properties | |
| BOOL | isDeletion |
| NSMutableDictionary * | properties |
| CBLJSONDict * | userProperties |
Properties inherited from CBLRevision | |
| CBLDocument * | document |
| The document this is a revision of. More... | |
| CBLDatabase * | database |
| The database this revision's document belongs to. More... | |
| BOOL | isDeletion |
| Does this revision mark the deletion of its document? (In other words, does it have a "_deleted" property?) More... | |
| BOOL | isGone |
| Does this revision mark the deletion or removal (from available channels) of its document ? (In other words, does it have a "_deleted_ or "_removed" property?) More... | |
| NSString * | revisionID |
| The ID of this revision. More... | |
| CBLSavedRevision * | parentRevision |
| The revision this one is a child of. More... | |
| NSString * | parentRevisionID |
| The ID of the parentRevision. More... | |
| CBLJSONDict * | properties |
| The revision's contents as parsed from JSON. More... | |
| CBLJSONDict * | userProperties |
| The user-defined properties, without the ones reserved by CouchbaseLite. More... | |
| - (void) setObject: | (nullable id) | object | |
| forKeyedSubscript: | (NSString *) | key | |
| - (nullable CBLSavedRevision*) save: | (NSError **) | outError |
Saves the new revision to the database.
This will fail with a 412 error if its parent (the revision it was created from) is not the current revision of the document. Afterwards you should use the returned CBLSavedRevision instead of this object.
| - (nullable CBLSavedRevision*) saveAllowingConflict: | (NSError **) | outError |
A special variant of -save: that always adds the revision, even if its parent is not the current revision of the document.
This can be used to resolve conflicts, or to create them. If you're not certain that's what you want to do, you should use the regular -save: method instead.
| - (void) setAttachmentNamed: | (NSString *) | name | |
| withContentType: | (nullable NSString *) | mimeType | |
| content: | (nullable NSData *) | content | |
Creates, updates or deletes an attachment.
The attachment data will be written to the database when the revision is saved.
| name | The attachment name. By convention, this looks like a filename. |
| mimeType | The MIME type of the content. |
| content | The body of the attachment, or nil to remove the attachment. |
| - (void) setAttachmentNamed: | (NSString *) | name | |
| withContentType: | (nullable NSString *) | mimeType | |
| contentURL: | (nullable NSURL *) | fileURL | |
Creates, updates or deletes an attachment whose body comes from a file.
(The method takes a URL, but it must be a "file:" URL. Remote resources are not supported.) The file need only be readable. It won't be moved or altered in any way. The attachment data will be copied from the file into the database when the revision is saved. The file needs to be preserved until then, but afterwards it can safely be deleted.
| name | The attachment name. By convention, this looks like a filename. |
| mimeType | The MIME type of the content. |
| fileURL | The URL of a local file whose contents should be copied into the attachment. |
| - (void) removeAttachmentNamed: | (NSString *) | name |
Removes the attachment with the given name.
When this revision is saved, it won't include the attachment. However, the attachment will still be present in the parent revision, until the database is next compacted.
|
readwriteatomicassign |
|
readwriteatomiccopy |
|
readwriteatomiccopy |