Find doesn't give any callback - no success or failure

I’m probably doing something wrong, because this find doesn’t get any success or failure callback (even after 10 seconds):


func findUsersWithQuery(query: String,
                            atPage page : Int,
                                   success : (items : [BackendlessUser]) -> Void,
                                   failure : (() -> Void)? = nil) {
        
        Types.tryblock({ () -> Void in
            
            let queryOptions = QueryOptions()
            queryOptions.relationsDepth = 0;
            queryOptions.pageSize = 20
            queryOptions.offset = queryOptions.pageSize.integerValue * page
            //            queryOptions.sortBy(["user.name desc"])
            
            let dataQuery = BackendlessDataQuery()
            dataQuery.queryOptions = queryOptions
            dataQuery.whereClause = "name LIKE '%\(query)%'"
            print(dataQuery.whereClause)
            
            Backendless.sharedInstance().persistenceService.find(BackendlessUser.ofClass(), dataQuery: dataQuery, response: { (collection : BackendlessCollection!) -> Void in
                
                success(items: collection.data as NSArray as! [BackendlessUser])
                
                }, error: { (fault : Fault!) -> Void in
                    print(fault.message)
                    failure?()
            })
            
            
            },
                       catchblock: { (exception) -> Void in
                        print("findUsersWithQuery (FAULT): \(exception as! Fault)")
                        failure?()
        })
    }

I’m trying to search for users with a specific name (autocomplete as user types in the searchbar).

App ID:
“CB4376D8-C109-F602-FF72-26B158EF2000”

Any Ideas? Thanks!

Hi Miroslav,

Have you tried testing the query using the search bar in Backendless console?

Mark

Yes, and surprisingly the console works just fine. The Backendless servers were really slow lately when I was using the app, but if it was timeout, I would get an error, right?

If it were a timeout, you’d get an error eventually. Has the code ever worked or it always hangs?

It did work and I had some strange experiences, like it wouldn’t return the user unless the query was the exact string of their name. This is a code of my client (I’ve got his permission) and I will try it again tomorrow when we’ll meet.

I’m experiencing the same thing now. Different method, no callback (no error or success).

 
 
 
 
 
 
 
 
 
 
 
 Types.tryblock({ () -> Void in 
 
 
 
 let queryOptions = QueryOptions() 
 
 queryOptions.relationsDepth = 0; 
 
 
 
 let dataQuery = BackendlessDataQuery() 
 
 dataQuery.queryOptions = queryOptions; 
 
 let userIDString = (phoneNumbers as NSArray).componentsJoinedByString("','") 
 
 dataQuery.whereClause = "phoneNumber in ('\(userIDString)')" 
 
 
 
 Backendless.sharedInstance().persistenceService.find(BackendlessUser.ofClass(), dataQuery: dataQuery, response: { (collection : BackendlessCollection!) -> Void in 
 
 
 
 success(users: collection.data as! [BackendlessUser]) 
 
 }, error: { (fault : Fault!) -> Void in 
 
 print(fault.message) 
 
 failure?() 
 
 }) 
 
 
 
 
 
 }, 
 
 catchblock: { (exception) -> Void in 
 
 print("(FAULT): \(exception as! Fault)") 
 
 failure?() 
 
 }) 



data query:

 
 
 
 
 
 
 
 
(lldb) po dataQuery.whereClause 
 
"phoneNumber in (\'+18885555512\',\'+18885551212\',\'+15555648583\',\'+14155553695\',\'+15555228243\',\'+15554787672\',\'+14085555270\',\'+14085553514\',\'+13032496396\',\'+15556106679\',\'+15557664823\',\'+17075551854\')" 



app id:

let APP_ID = "6E488EAD-7715-221A-FF61-530B8215CC00"

Backendless user extension:

extension BackendlessUser {

 
 
 
 
 
 
 
 
 
 
 
 
 
 func _phoneNumber() -> String { 
 
 return self.getProperty("phoneNumber") as! String 
 
 } 
 
 
 
 func _setPhoneNumber(newValue : String) { 
 
 self.setProperty("phoneNumber", object: newValue) 
 
 } 
 
 
 
 func _potentialContacts() -> [PotentialUser]? { 
 
 return self.getProperty("potentialContacts") as? [PotentialUser] 
 
 } 
 
 
 
 func _contacts() -> [BackendlessUser]? { 
 
 return self.getProperty("contacts") as? [BackendlessUser] 
 
 } 
 
 
 
 // Derived Values 
 
 
 
 func isUser() -> Bool { 
 
 return self.objectId == NetworkService.sharedInstance.currentUser.objectId 
 
 } 
 
} 



EDIT:

The same code worked for me 1 hour ago. I didn’t change anything - it’s the same commit.

EDIT2:
sql query

phoneNumber in ('+18885555512','+18885551212','+15555648583','+14155553695','+15555228243','+15554787672','+14085555270','+14085553514','+13032496396','+15556106679','+15557664823','+17075551854')

works in console