나는 소셜 기반의 소셜 네트워크를 개발하려고 시도하고 있으며, 각 "그룹"에 대해 투표 시스템을 만드는 데 문제가 있습니다. 내 TableViewController 내에서 PFQueryTableViewController를 사용하여 "사용되지 않은 식별자 '개체'사용"오류가 나타납니다. 여기에 사람이 문제가 여기에 무엇을 알고 있다면 내가해결되지 않은 식별자 'object'의 사용 Xcode 6 Swift
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as GroupTableViewCell
group:PFObject = self.timelineData.objectAtIndex(indexPath.row) as PFObject
cell.groupTextView.alpha = 0
cell.timeStampLabel.alpha = 0
cell.UserNameLabel.alpha = 0
cell.groupTextView.text = group.objectForKey("content") as String
var dataFormatter:NSDateFormatter = NSDateFormatter()
dataFormatter.dateFormat = "MM/DD/yyyy HH:mm"
cell.timeStampLabel.text = dataFormatter.stringFromDate(group.createdAt)
let score = object.valueForKey("count") as? Int
cell.count.text = "\(score)"
cell.groupTextView.text = object.valueForKey("content") as? String
var findUser:PFQuery = PFUser.query()
findUser.whereKey("objectId", equalTo: group.objectForKey("User").objectId)
findUser.findObjectsInBackgroundWithBlock {
(objects:[AnyObject]!, error:NSError!)->Void in
if error == nil{
let user:PFUser = (objects as NSArray).lastObject as PFUser
cell.UserNameLabel.text = user.username
UIView.animateWithDuration(0.5, animations: {
cell.groupTextView.alpha = 1
cell.timeStampLabel.alpha = 1
cell.UserNameLabel.alpha = 1
작업을하고있는 부분이며, 개발자의 초보자를 도와주세요.
완전성과 형식에 대한 소감에서 다른 방법을 추가 :
override func objectAtIndexPath(indexPath: NSIndexPath!) -> PFObject! {
var object : PFObject? = nil
if(indexPath.row < self.objects.count) {
object = self.objects[indexPath.row] as? PFObject
}
return object
}
오류를 일으키는 행은 어디에서 발생하며 해당 행에서 '객체'선언은 어디에 있습니까? –