解析PFQuery whereKey:notEqualTo不能用于PFUser对象 [英] Parse PFQuery whereKey:notEqualTo is not working for PFUser objects
问题描述
我认为这是Parse的一个错误,但我不知道在哪里报告它。
I think this is a bug in Parse, but I don't know where to report it.
我使用Parse与Swift。我有一个 PFQueryTableViewController
。
I'm using Parse with Swift. I have a PFQueryTableViewController
.
在我的 queryForTable
, CAN 可以使用以下查询:
In my queryForTable
function, I CAN use this following query just fine:
query.whereKey(kHWActivityFromUserKey, equalTo: User.currentUser())
但是,当我改变 equalTo
到 notEqualTo
,如下所示:
However, when I change equalTo
to notEqualTo
, like this:
query.whereKey(kHWActivityFromUserKey, notEqualTo: User.currentUser())
...然后表保持空白没有。 (它甚至不显示空行。)
... then the table stays blank and just does nothing. (It does not even show empty rows.)
我试图找出发生了什么,所以我采取了这个查询,我调用 findObjectsInBackgroundWithBlock
手动地查看块中的对象
和错误
令人惊讶的是,该块从未被调用!
I tried to figure out what was going on, so I took that query and I called findObjectsInBackgroundWithBlock
on it manually, to look at the objects
and error
inside the block. Surprisingly, the block was never called!
所以我在主线程上运行查询,如下:
So then I ran the query on the main thread, like this:
var error = NSErrorPointer()
var objects = query.findObjects(error)
当我运行这个程序时,我的整个应用程序崩溃,出现以下异常:
When I ran this, my whole app crashed with the following exception:
2015-02-11 13:26:45.339 HDWR[18996:3057150]
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'Couldn't create cache key from
<PFUser: 0x7f8e885de7c0, objectId: X7lSc1Gajm, localId: (null)> {
...
所以我认为有一个与缓存有关的错误, whereKey:notEqualTo
与 PFObject
。
So I think there is a bug related to caching whenever I use whereKey:notEqualTo
with a PFObject
.
ve还尝试在查询中使用 objectId
字符串,如下所示:
I've also tried using the objectId
string in the query instead, like this:
query.whereKey(kHWActivityFromUserKey, notEqualTo: User.currentUser().objectId)
只是给我一个指针错误:
But then Parse just gives me a pointer error:
2015-02-11 13:45:46.550 HDWR[19708:3069545]
Error: pointer field fromUser needs a pointer value (Code: 102, Version: 1.6.0)
我如何报告这个bug到Parse?或者你有任何想法的解决方法?我们需要在我们的应用程序中有这个逻辑。
How can I report this bug to Parse? Or do you have any idea for a workaround? We kind of need to have this logic in our app.
推荐答案
这是Parse iOS SDK中的一个错误, c $ c> 1.6.1 。它似乎固定在 1.6.2
中。
This was a bug in the Parse iOS SDK, version 1.6.1
. It appears to be fixed in 1.6.2
.
这篇关于解析PFQuery whereKey:notEqualTo不能用于PFUser对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!