gpi*_*ler 7 ios parse-platform
当我在Parse后端更改例如bool时,我无法在我的iOS应用程序中检索此值.请参阅以下屏幕截图,其中第一个bool用户对象已手动更改,第二个已从应用程序更改.

第一个不起作用,而一个(从应用程序更改)确实有效.我正在使用以下代码获取值:
[[PFUser currentUser] objectForKey:@"is_pro"]
Run Code Online (Sandbox Code Playgroud)
在第一种情况下,返回对象总是nil(我手动更改了bool).
Lyn*_*ott 16
在对用户的Parse表进行更改后,请致电
[[PFUser currentUser] fetch]; //synchronous
Run Code Online (Sandbox Code Playgroud)
要么
[[PFUser currentUser] fetchInBackground]; //asynchronous
Run Code Online (Sandbox Code Playgroud)
要么
[[PFUser currentUser] fetchInBackgroundWithBlock:^(PFObject *object, NSError *error) { //asynchronous with completion block
Run Code Online (Sandbox Code Playgroud)
之前
[[PFUser currentUser] objectForKey:@"is_pro"]
Run Code Online (Sandbox Code Playgroud)
获取[PFUser currentUser]对象的更新副本.
注:refresh和refreshInBackgroundWithBlock:现在过时,已被替换fetch和fetchInBackgroundWithBlock:
更新:
瑞安Kreager在评论中指出,它可能会更好/更有效地使用fetchIfNeeded,fetchIfNeededInBackground或者fetchIfNeededInBackgroundWithBlock:"因为他们将尽可能使用本地缓存."
| 归档时间: |
|
| 查看次数: |
3660 次 |
| 最近记录: |