-
Notifications
You must be signed in to change notification settings - Fork 298
v1.1 API Changes
Here are all of the API changes from release 1.0.4 to 1.1 of Couchbase Lite for iOS (and Mac OS X.) You can get more information about any new method/property by looking for it in its header file and reading the documentation comment above it.
- The headers now use the new
nullable
attribute. Any parameters that aren't prefixed withnullable
may not takenil
values, and (starting in Xcode 6.3) will produce a compile error if you call them with a constantnil
value. In Swift, a non-nullable parameter will be typed as non-optional (e.g. of typeString
rather thanString?
) -- this will make your app code simpler and clearer.
- You can now read an attachment as a stream by calling
-openContentStream
. (Just make sure to close the stream when you're done.) - The
.contentURL
property is informally deprecated, because the file it points to will be encrypted (hence useless to you) if you've enabled database encryption.
-
-setAnonymousSSLIdentityWithLabel:error:
enables SSL by creating an anonymous self-signed SSL certificate (stored in the device's keychain). This is not as useful as a "real" cert from a registrar, since it contains no identifying information, but it does serve to encrypt the replicator traffic, and a client can use cert-pinning across multiple connections to ensure it's connecting to the same device/app as before. -
The
.SSLIdentityDigest
property returns a SHA digest of the listener's SSL cert's public key. This can be used as a fingerprint identifying the listener, which is useful in peer-to-peer pairing.
-
-databaseExistsNamed:
lets you query for the existence of a database without opening it. -
-registerEncryptionKey:forDatabaseNamed:
is your entry point to database encryption. -
-replaceDatabaseNamed:
... has changed its parameters due to the new database layout. Since a CBL database is now stored as a directory, with the SQLite database and attachments inside, you only need to provide that one directory's path when importing a database.
- Support for querying inverse relations:
- The new method
-findInverseOfRelation:fromClass:
queries an inverse relation: it finds the other models in the database that have a specific property that references the receiver. See the header comments for more details. - It's also possible to declare a property whose value will be computed as an inverse-relation query, by implementing
+inverseRelationForArrayProperty:
.
- The new method
- CBLModel now has no public initializer methods, and you should not implement any yourself in subclasses.
- Instead of calling
-initWithNewDocumentInDatabase:
, call+modelForNewDocumentInDatabase:
. - In a subclass, to set up transient state of an instance, override
-awakeFromInitializer
.
- Instead of calling
- Added
-documentTypeForClass:
and-documentTypesForClass:
, to look up which JSONtype
property(ies) are associated with a particular CBLModel subclass.
-
CBLAllDocsMode
now has a new value,kCBLBySequence
, which produces a "changes feed" with documents ordered by their sequence number, i.e. in the order in which they were last changed. - CBLLiveQuery has a new method
-queryOptionsChanged
. Call this if you change the query's options (startKey
,endKey
,descending
, etc.) after the live query has started running, so it'll pick up the changes. - Removed
fullTextQuery
andfullTextSnippets
properties, as they're not supported with ForestDB storage.
New in this release, CBLQueryBuilder lets you create Core Data-like queries using NSPredicates without having to manually define map functions. See the documentation for details.
- The
.pendingDocumentIDs
property and-isDocumentPending:
method allow you to check which documents have local changes that haven't yet been pushed to the server.
- The
.documentType
property can help optimize indexing performance. Read the documentation.