2017-05-03 19 views
0

由于某些原因,在模拟器上测试我的应用程序时,用户数据永远不会更新。例如,对象“年龄”的值可以更改为22,但模拟器的行为就好像它仍然是21.是否有人知道它是否只是模拟器问题,并且在电话上运行方式不同?我的iPhone屏幕完全破损,所以我现在无法对其进行测试。在iPhone模拟器上解析PFUser数据未更新

+0

我有一个真正的设备上同样的问题。 –

+0

@GellertLee你认为这是一个解析问题吗? – Dups

+0

@Dups你是否更新手机或服务器上的数据? –

回答

0

在解析,PFUserPFObject一个子类,以更新PFObjectParse iOS SDK你有很多方法可以做到这一点

有2种流行的方法:

例如与fetch

guard let myUser = PFUser.current() else { return } // Get the current user 
do { 
try myUser.fetch() 
} catch { 
    print("Error when fetching the new data") 
} 

例如与fetchInBackground

guard let myUser = PFUser.current() else { return } // Get the current user 
myUser.fetchInBackground() 

你也可以使用封与fetchInBackgroundWithBlock