I am using Parse for my databases, and I just updated the parse SDKs and Xcode to version 7 with swift 2. However, now I am getting an error when the query below starts. The problem starts at the "findobjectsinbackground" part as the "third" print is not seen. Any ideas?
The Error:
2015-09-22 09:57:45.247 MyProject[456:133409] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This query has an outstanding network connection. You have to wait until it's done.' * First throw call stack: (0x275d386b 0x38f86dff 0x275d37b1 0x638ac9 0x638b41 0x639bf9 0x6397bb 0x6399bf 0x2b5e78 0x2b4e94 0x2b5154 0x2b6e56ab 0x2b79fe97 0x2b79fd91 0x2b79f135 0x2b79ed8f 0x2b79e9dd 0x2b79e957 0x2b6e16bb 0x2afad67d 0x2afa8d79 0x2afa8c09 0x2afa8129 0x2afa7deb 0x2b6d860d 0x275960f1 0x275943e7 0x27594825 0x274e71e9 0x274e6fdd 0x3078baf9 0x2b74c18d 0x5fa6f4 0x396b1873) libc++abi.dylib: terminating with uncaught exception of type NSException
followArray.removeAll(keepCapacity: false)
followArray2.removeAll(keepCapacity: false)
let followQuery = PFQuery(className: "follow")
followQuery.whereKey("user", equalTo: PFUser.currentUser()!.username!)
followQuery.whereKey("followAproval", equalTo: 1)
followQuery.addDescendingOrder("createdAt")
var myObjects = [PFObject]()
followQuery.findObjectsInBackgroundWithBlock {
(objects:[PFObject]?, error:NSError?) -> Void in
if error == nil {
myObjects = objects!
for object in myObjects {
self.followArray.append(object.objectForKey("userToFollow") as! String)
}
}
}
var myObjects2 = [PFObject]()
let generalQuery = PFQuery(className: "tweets")
generalQuery.addDescendingOrder("createdAt")
generalQuery.limit = 100
followQuery.findObjectsInBackgroundWithBlock {
(objects:[PFObject]?, error:NSError?) -> Void in
if error == nil {
myObjects2 = objects!
for object in myObjects2 {
self.followArray2.append(object.objectForKey("userName") as! String)
}
}
}