0
我目前正在嘗試在另一個用戶的數組中保存一個objectId。不幸的是,我收到一個錯誤。這裏是我的嘗試:在另一個用戶插入一個ObjectId - 解析和Swift
let name = (PFUser.currentUser()!["FirstName"] as! String) + " " + (PFUser.currentUser()!["LastName"] as! String)
let News = News(title: "\(name) accepted your ...", user: PFUser.currentUser()!)
News.saveInBackgroundWithBlock({ (success: Bool, error: NSError?) -> Void in
if (success){
let user = self.interest.user as! User
user.joinNews(News.objectId!)
} else {
print("--------")
}
})
這裏是我爲這個創建的FUNC joinNews:
public func joinNews(newsId: String) {
newsIds.insert(newsId, atIndex: 0)
saveInBackgroundWithBlock { (success, error) -> Void in
if error != nil {
print("\(error!.localizedDescription)")
}
}
}
在此先感謝您的幫助!
你得到什麼錯誤? –
哦耶對不起,我忘記了......我的壞...這裏是:「抓住」NSInternalInconsistencyException「與原因」用戶不能被保存,除非他們已通過登錄或註冊認證「 –