【发布时间】:2015-05-10 08:00:13
【问题描述】:
我正在使用下面的代码来保存当前登录的用户和自定义字段。我允许用户填写信息然后保存。我使用 GCM 在我自己的线程上使用了两种保存方法,并使用了 saveInBackgrounWithBlock。在 iOS8 上,这可以正常工作,但在 iOS7 上保存永远不会发生,并且永远不会调用完成块。有任何想法吗?谢谢
if PFUser.currentUser() != nil {
PFUser.currentUser().setObject(installation, forKey: "installation")
PFUser.currentUser().saveInBackgroundWithBlock({ (bool: Bool, error: NSError?) -> Void in
if(error != nil) {
let alert = UIAlertView(title: "Problem Saving", message: "Make sure you are connecte to the internet and try again", delegate: nil, cancelButtonTitle: "OK")
alert.show();
}
})
}
更新 1: 我注意到删除该应用可以暂时解决问题。但是,在退出并与其他用户登录(即更改当前用户)后,问题会再次弹出。
更新 2: 问题似乎来自 PFInstallation。使用 addUniqueObject 会导致问题。调用此方法后,任何保存都停止工作 iOS7。即使在 PFUser 上。 PFUser 具有安装设置,反之亦然。它们的数组。
更新 3: 似乎不仅仅是 addUniqueObject,还有 PFInstallation.currentInstallation 上的任何 setObject。救命!
【问题讨论】:
标签: ios iphone parse-platform pfuser