Originally created by @TheJustikar on GitHub (Dec 17, 2020).
Hi,
I have 2 entities, Match and Player, both CoreStoreObject's. Match has 2 relationships to Player called winners and losers (and respective inverses in Player).
When trying to filter the matches with this Where:
let players: [Player] = ...
Where<Match>(NSPredicate(format: "(ANY winners IN %@) OR (ANY losers IN %@)", players, players))
I get this error:
2020-12-17 23:37:35.782071+0100 APP_NAME[7234:510265] *** NSForwarding: warning: object 0x600003a64bb0 of class 'APP_NAME.Player' does not implement methodSignatureForSelector: -- trouble ahead
Unrecognized selector -[APP_NAME.Player longLongValue]
2020-12-17 23:37:35.782436+0100 APP_NAME[7234:510265] Unrecognized selector -[APP_NAME.Player longLongValue]
Unrecognized selector -[APP_NAME.Player longLongValue]
I tested this predicate without CoreStore and it works.
Originally created by @TheJustikar on GitHub (Dec 17, 2020).
Hi,
I have 2 entities, `Match` and `Player`, both `CoreStoreObject`'s. `Match` has 2 relationships to `Player` called `winners` and `losers` (and respective inverses in `Player`).
When trying to filter the matches with this `Where`:
```
let players: [Player] = ...
Where<Match>(NSPredicate(format: "(ANY winners IN %@) OR (ANY losers IN %@)", players, players))
```
I get this error:
```
2020-12-17 23:37:35.782071+0100 APP_NAME[7234:510265] *** NSForwarding: warning: object 0x600003a64bb0 of class 'APP_NAME.Player' does not implement methodSignatureForSelector: -- trouble ahead
Unrecognized selector -[APP_NAME.Player longLongValue]
2020-12-17 23:37:35.782436+0100 APP_NAME[7234:510265] Unrecognized selector -[APP_NAME.Player longLongValue]
Unrecognized selector -[APP_NAME.Player longLongValue]
```
I tested this predicate without `CoreStore` and it works.
@TheJustikar Thanks for reporting. I'll add an enhancement for this in a future update, but for now you'll need to extract the NSManagedObjects since NSPredicates don't know how to interpret CoreStoreObjects. Please try:
letplayers:[Player]=// ...Where<Match>("(ANY winners IN %@) OR (ANY losers IN %@)",players.map{$0.cs_toRaw()},players.map{$0.cs_toRaw()})
@JohnEstropia commented on GitHub (Dec 19, 2020):
@TheJustikar Thanks for reporting. I'll add an enhancement for this in a future update, but for now you'll need to extract the `NSManagedObject`s since `NSPredicate`s don't know how to interpret `CoreStoreObjects`. Please try:
```swift
let players: [Player] = // ...
Where<Match>(
"(ANY winners IN %@) OR (ANY losers IN %@)",
players.map { $0.cs_toRaw() },
players.map { $0.cs_toRaw() }
)
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @TheJustikar on GitHub (Dec 17, 2020).
Hi,
I have 2 entities,
MatchandPlayer, bothCoreStoreObject's.Matchhas 2 relationships toPlayercalledwinnersandlosers(and respective inverses inPlayer).When trying to filter the matches with this
Where:I get this error:
I tested this predicate without
CoreStoreand it works.@JohnEstropia commented on GitHub (Dec 19, 2020):
@TheJustikar Thanks for reporting. I'll add an enhancement for this in a future update, but for now you'll need to extract the
NSManagedObjects sinceNSPredicates don't know how to interpretCoreStoreObjects. Please try: