"Can't bind intarray" error when performing fetch request

Hi,


We've some code that's performing a fetch request with an IN predicate, like so:

NSArray *remoteIDs = @[ @"id1", @"id2", etc ];
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:[SomeEntity entityName]];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"primaryKey IN %@", remoteIDs];
fetchRequest.predicate = predicate;
fetchRequest.relationshipKeyPathsForPrefetching = @[@"relationship1",@"relationship2"];
fetchRequest.sortDescriptors = @[ [NSSortDescriptor sortDescriptorWithKey:NSStringFromSelector(@selector(updatedAt)) ascending:NO] ];

// fetch request is executed


It's nothing complicated, and this code's been working for years.


Recently we started seeing numerous instances of the following error in our app in production:


"Error Domain=NSCocoaErrorDomain Code=134180 "An SQLite error occurred." UserInfo={NSSQLiteErrorDomain=14, NSUnderlyingException=CoreData: SQLite: error: Can't bind intarray. SQLite error code: 14}"


I've logged the value of the remoteIDs variable when the error occurs and it's always an array of strings, as expected. The upshot for us is that our query fails and we aren't able to find existing records. This means we're occasionally duplicating objects, which isn't great.


I can't find any information on what this error is or why it would be triggered. If anyone could offer some insight into this I'd be most grateful!


Cheers,

Craig

"Can't bind intarray" error when performing fetch request
 
 
Q