diff --git a/Objective-C/Tests/VectorSearchTest+Lazy.m b/Objective-C/Tests/VectorSearchTest+Lazy.m index e9967600e..95f30a3a8 100644 --- a/Objective-C/Tests/VectorSearchTest+Lazy.m +++ b/Objective-C/Tests/VectorSearchTest+Lazy.m @@ -69,9 +69,11 @@ - (CBLVectorIndexConfiguration*) lazyVectorIndexConfigWithExpression: (NSString* NSArray* vector; CBLQueryResult *result = [rs nextObject]; if (result) { - id value = [result arrayAtIndex: 0]; + CBLArray* value = [result arrayAtIndex: 0]; if (value) { - vector = (NSArray*)value; + // Copy the values out of the fleece-backed CBLArray, which is only + // valid while the result set is alive: + vector = (NSArray*)[value toArray]; } } return vector;