Query Time Out

I am calling a search query from a method in iOS and keep timing out. viewDidLoad calls loadPosts(), which times out each time. Am I missing something? Everything else is working great.

override func viewDidLoad()
 {
 super.viewDidLoad()
 
 self.navigationItem.title = self.backendless?.userService.currentUser.getProperty("username") as! String?
 // Set up the UIRefreshController
 refresher = UIRefreshControl()
 refresher.addTarget(self, action: #selector(HomeVC.refresh), for: .valueChanged)
 collectionView?.addSubview(refresher)
 
 self.loadPosts()
 }
func loadPosts()
 {
 // Get the curentUser's username
 let currentUserUsername = self.backendless?.userService.currentUser.getProperty("username") as! String?
 
 // Search for the username to see if it already exists. Create whereClause and dataQuery.
 let whereClause = "username = '" + currentUserUsername! + "'"
 let dataQuery = BackendlessDataQuery()
 dataQuery.whereClause = whereClause
 
 // I am timing out here.
 self.backendless?.data.of(PostsBE.ofClass()).find(dataQuery, response: {(result : BackendlessCollection?) -> () in
 
 print("When is this getting called?")
 
 }, error: { (fault : Fault?) -> () in
 
 print("Server reported an error: \(fault)")
 })
 }

Hi Jon,
Did you try running this query with REST console?
Artur

I’m trying but not having much luck. If my PostsBE object has a “username” what is the proper syntax to type in the where textfield in the Rest API. I’ve tried multiple options like the one below but they are not working.

username = jonthornham

for the columns of type STRING, EXT STRING and TEXT, the value must be surrounded by single quotes:

username = 'jonthornham'

Thanks.

The request works in the REST API without any issues. Any thoughts as to why it’s timing out in the app?

Jon, I cannot reproduce this issue with my data.
Could you provide your appId and PostsBE class, I’ll check this problem with your data.

I have added the AppId, the PostsBE class and the error message I just received running the code.

1AA67510-BC94-C947-FFEF-2D0CB7DCB900

2016-11-16 16:40:12.357 Instagram[1217:51571] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9806)
Data does not equal nil
Server reported an error: Optional(FAULT = '-1200' [NSURLErrorDomain] <An SSL error has occurred and a secure connection to the server cannot be made.> )
import Foundation
import UIKit


class PostsBE: NSObject
{
    // This is a custom class used to access Tip Objects that are stored Backendless.
    var objectId : String?
    var created : Date?
    var updated : Date?
    var username : String?
    var title : String?
    var pic : String?
    var ava : String?
    var uuid : String?
}

Any idea what’s going on here? Did the AppId help at all? I’ve been running multiple queries with success. This is the only one in the project that hangs.