使用FBSUIApplicationSystemService解析查询超时:请求获取徽章值超时

时间:2015-08-26 03:17:48

标签: ios swift parse-platform

我有一个用Swift编写的Parse查询,用户可以查看所有照片。我正在使用query.whereKey("", matchesKey: "", inQuery:)来获取我的对象,然后在每个循环之后获取PFFile数据,并重新加载表视图。因此,在下载每张照片后,表视图应该加载(照片只有150x150。查询限制越高,任何信息加载的可能性就越小。当限制设置为1000时,页面总是不加载。它通常仅在限制为< = 60.

有时我得FBSUIApplicationSystemService: request to get badge value timed out我不知道它意味着什么,而有时我什么也得不到。这是Parse超时问题吗?我该如何解决这个问题?

// Reloads table view
    var imageSet:Bool = false {
        didSet {
            if imageSet {

                dispatch_async(dispatch_get_global_queue(Int(QOS_CLASS_USER_INITIATED.value), 0)) { // 1
                    dispatch_async(dispatch_get_main_queue()) { // 2
                        self.tableView.reloadData() // 3

                    }
                }
            }
        }
    }

    // Gets photos
    var dataLoaded:Bool = false {
        didSet {
            if dataLoaded {

                let photoArt = photoCovers.last!
                let indexNumber = find(photoCovers, photoCovers.last!)!

                photoArt.getDataInBackgroundWithBlock({ (imageData, error) -> Void in

                    if error == nil {
                        if let imageData = imageData {
                            let image = UIImage(data: imageData)
                            self.photoArt[indexNumber] = image
                        }

                    } else {

                        println(error)

                    }
                    self.imageSet = true
                })
            }
            self.imageSet = false
        }
    }

        var innerQuery = PFQuery(className: "Followers")

        innerQuery.whereKey("followerId", equalTo: PFUser.currentUser()!.objectId!)

        var query = PFQuery(className: "Pictures")

        query.whereKey("user", matchesKey: "followingId", inQuery: innerQuery)

        query.limit = 100

        query.findObjectsInBackgroundWithBlock { (objects, error) -> Void in
            if error == nil {

                if let objects = objects {

                    for object in objects {

                        if let user = object["user"]! as? String {

                            if (self.users.filter { $0 == user }.count) < 30 {

                                self.users.append(user)

                                if let caption = object["caption"] as? String {
                                    self.captions.append(caption)
                                }

                                if let photographer = object["photographer"] as? String {
                                    self.photographers.append(photographer)
                                }

                                if let userName = object["userName"] as? String {
                                    self.userNames.append(userName)
                                }

                                if let photoCover = object["photoCover"] as? PFFile {
                                    self.photoCovers.append(photoCover)
                                }

                                if let userId = object["user"] as? String {
                                    self.userIds.append(userId)
                                }

                                self.dataLoaded = true
                            }

                        }

                    }

                }

            } else {

                println(error)

            }

            self.dataLoaded = false
        }

0 个答案:

没有答案