I get an exception when trying to create an NSPredicate object that looks like this:
let searchPredicate = NSPredicate(format: "addonCategoryId IN \(idsArray)")
where idsArrayconsists of objects Intin the swift array. An exception occurs on this line. The console says:
idsArray
Int
2015-10-08 08: 21: 42.878 bkApp [2569: 510538] *** Application terminated due to uncaught exception "NSInvalidArgumentException", reason: "Unable to parse format string" addonCategoryId IN [5404, 5406] ""
What could be the problem? Thanks for watching. :)
NSPredicate Objective-C. .
NSPredicate
let searchPredicate = NSPredicate(format: "addonCategoryId IN \(idsArray)") // result: addonCategoryId IN [5404, 5406]
:
let searchPredicate = NSPredicate(format: "addonCategoryId IN %@", idsArray) // result: addonCategoryId IN {5404, 5406}
[] vs. {}, NSPredicate , .
[]
{}
Source: https://habr.com/ru/post/1610678/More articles:SQLException: Не найдено подходящего драйвера для url = jdbc: derby - javaThe best way to insert 3D array values inside another larger array is numpyHeaders Security Issues in C ++ - c ++How to make np.roll () faster? - numpyUsing Powershell to Call a WCF Service Method - c #Partially compile C ++ source code - c ++Open website with SFSafariViewController from auto-detected UITextView link - iosCan I do something like imsave () with text overlay? - numpyMutate with dplyr using several conditions - rHow to hide / show marker groups by categories using Google Maps in Android? - androidAll Articles