Parse platform 用户登录Facebook后,安装不存在
我们在Parse.com FaceBook登录时遇到了这种情况。以下是步骤:Parse platform 用户登录Facebook后,安装不存在,parse-platform,Parse Platform,我们在Parse.com FaceBook登录时遇到了这种情况。以下是步骤: 从AppStore下载并安装应用程序 用户使用Facebook帐户登录 通常,\ u Installation集合中有一个新行,\ u User集合中也有一个新行。但是,当用户的_用户条目存在时,_安装条目有时会丢失 我们的应用程序需要在用户和他/她的设备之间建立逻辑链接,以实现每个用户一台设备的策略 当用户(由_user条目表示)由于相应的_安装条目不存在而无法链接时,应用程序将中断。我们只在iOS 7上观察到这个b
请检查这是否是Parse SDK中的错误?如果是这样的话,什么时候可以使用修复程序?我没有遇到您所描述的确切问题,但是我遇到了一些使用Parse和Swift的类似实例,其中将创建
\u用户
,并创建\u安装
对象,但它们不会被链接。我所做的是在我的应用程序主页的ViewController
的ViewDidLoad
功能中添加一个函数(登录屏幕后的第一个屏幕),以确保两者都已设置并链接。希望有帮助
override func viewDidLoad() {
if ((PFUser.currentUser()) != nil) {
var current: PFInstallation = PFInstallation.currentInstallation()
current["userId"] = PFUser.currentUser()
current.saveEventually()
}
}
编辑:在我的项目中,我需要添加上面的代码,因为下面的代码并不总是将\u User
对象保存到我的AppDelegate
文件中的\u Installation
对象
func application(application: UIApplication!, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData!) {
let currentInstallation:PFInstallation = PFInstallation.currentInstallation()
currentInstallation.setDeviceTokenFromData(deviceToken)
if ((PFUser.currentUser()) != nil) {
currentInstallation["userId"] = PFUser.currentUser()
}
currentInstallation.saveInBackgroundWithTarget(nil, selector: nil)
}
我想你的意思是_安装数据条目有时在上述代码段完成之前无法创建?你有关于这种不良行为的官方错误报告吗?谢谢顺便说一句,链接部分是我们应用程序特有的功能。很抱歉,为了澄清安装对象是在我的
AppDelegate
文件中创建的,但是,指向\u User
对象的指针并不总是保存在我的didRegisterForRemoteNotificationsWithDeviceToken
函数中,因此我需要在viewDidLoad
中添加该函数来执行相同的操作,以确保它们被链接。不幸的是,我没有关于这种行为的官方bug报告