Limit and sort by

I’m using a Live query in CBL 1.2.1 and when all documents are requested they are sorted in the way I wanted (timestamp). But when I add the limit parameter, the results do not return the latest documents but another section of the documents. I tried using the NSSortDescriptor but it seems to be ignore. This is a snippet of my code:

theLiveQuery.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey: @“value.timestamp” ascending: YES]];
theLiveQuery.limit = 50;

How do you fetch a limited set of documents with the newest ones at the top?

Can you show the entire code that creates and runs the query?