Create CBLModel with given _id on iOS

11 views
Skip to first unread message

Jeremy Kelley

unread,
Aug 11, 2015, 5:32:59 PM8/11/15
to mobile-c...@googlegroups.com
Perhaps I'm missing the obvious method, but is there a way to create a Model object with a specific case?

I have tried overriding:

- (NSString*) idForNewDocumentInDatabase: (CBLDatabase*)db __attribute__((nonnull));

But by the time modelForNewDocumentInDatabase is returned, I'm not able to pass in the ID I would like to assign that I can reference in idForNewDocumentInDatabase.

I feel I'm missing something obvious and any pointers be greatly appreciated.

-j


Jens Alfke

unread,
Aug 11, 2015, 6:30:55 PM8/11/15
to Couchbase Mobile

> On Aug 11, 2015, at 2:32 PM, Jeremy Kelley <jer...@33ad.org> wrote:
>
> Perhaps I'm missing the obvious method, but is there a way to create a Model object with a specific case?

Do you mean “with a specific ID”?

[MyModel modelForDocument: [db documentWithID: whateverID]];

—Jens

Jeremy Kelley

unread,
Aug 11, 2015, 7:14:49 PM8/11/15
to mobile-c...@googlegroups.com
Perfect! I'll give that a try later tonight. Thanks. -j

--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/0D9A7D5A-F40A-4B6F-8FA8-DF7C7B76A395%40mooseyard.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages