nextPageAsync is not loading next page's element

it was working fine before but now i dont know why nextPageAsync is not returning anything this is how am loading my objects in pages :

func queryEventsFromServer(){
 
 
 
 let dataQuery = BackendlessDataQuery()
 dataQuery.whereClause = whereClause
 let dataStore = backendless.data.of(PEvents)
 dataQuery.queryOptions.pageSize(5)
 dataQuery.queryOptions.related = ["b_publisher"] // my related Table (Users)
 
 
 dataStore.find(dataQuery,
 
 response: { (result: BackendlessCollection!) -> Void in
 let event = result.getCurrentPage()
 
 *** here am also prinitng the value of "result" maybe it'll help for better understanding ***
// <BackendlessCollection> -> type: myPackage.EventsClass, offset: 0, pageSize: 5, totalObjects: 7, data: (
// "<myPackage.EventsClass: 0x13948e1c0>",
// "<myPackage.EventsClass: 0x139487780>",
// "<myPackage.EventsClass: 0x1394b0960>",
// "<myPackage.EventsClass: 0x1393d34c0>",
// "<myPackage.EventsClass: 0x1393d50f0>"
// ), query: <BackendlessDataQuery> -> properties: (null), whereClause: age = '21', queryOptions: <QueryOptions> -> {
// offset = 0;
// pageSize = 5;
// related = (
// "b_publisher"
// );
// }
 
 
 print("TOTAL EVENTS = \(result.totalObjects)") // right now its 7
 
 for obj in event as! [PEvents] {
 
 // here i got my first 5 Objects in page 1
 
 }
 self.fetchResults = result
 },
 error: { (fault: Fault!) -> Void in
 print("Server reported an error: \(fault)")
 self.activityIndicatorView.stopAnimating()
 
 self.footerRetryButton.hidden = false
 
 
 
 })
}

the above function is for making the first call
below function is for loading next pages


func loadNextPage(){ // function for loading next pages
 
 if Int (fetchResults.totalObjects) >= fetchOffset {
 
 if fetchOffset > 0 {
 
 fetchResults.offset = fetchOffset // right now its 5
 }
 
 fetchResults.nextPageAsync( { (nextResult : BackendlessCollection!) in
 
 
 *** here am also prinitng the value of "nextResult" maybe it'll help for better understanding ***
// 
// <BackendlessCollection> -> type: myPackage.EventsClass, offset: 10, pageSize: 5, totalObjects: 7, data: (
// ), query: <BackendlessDataQuery> -> properties: (null), whereClause: age = '21', queryOptions: <QueryOptions> -> {
// offset = 10; // i dont know why its 10 here but it supposed to be 5 cause i set to 5 
// pageSize = 5;
// related = (
// );
// }
// 
 let Event = nextResult.getCurrentPage() // value of event is 0
 print ("\(Event.count)") //returning 0
 for obj in Event as! [PEvents] {
 
 }
 
 self.fetchResults = nextResult
 
 })
 { (error : Fault!) in
 
 print("Server reported an error: \(error)")
 
 self.activityIndicatorView.stopAnimating()
 self.footerRetryButton.hidden = false
 }
 }
 
}

P.S. i recently changed the relation in my table is it why its happening ??

Please give us your appId here or to support@backendless.com, we will check this issue with your data.

i just forwarded it to support@backendless.com. @vyachslav

You could investigate this our sample project (it has obj-c and swift targets). See basicPagingAsync() method.

well can you fix this ?
Server reported an error: FAULT = ‘2002’ [Version is disabled or provided wrong application info (application id or secret key)] <Version is disabled or provided wrong application info (application id or secret key)>

i really dont wanna create a new project and add those classes here

This fault means that you use invalid appId or/and secretKey.Please clarify if this fault is received with your app or with our sample?

The working sample project is sent to your email.

You could check this code for async data fetching:

    func basicPagingAsync() {
        
        let startTime = NSDate()
        
        let query = BackendlessDataQuery()
        query.queryOptions.pageSize(5)
        query.queryOptions.related = ["b_publisher"]


        backendless.persistenceService.of(PEvents.ofClass()).find(
            query,
            response: { ( bc : BackendlessCollection!) -> () in
                print("Total objects - \(bc.totalObjects)")
                self.nextPageAsync(bc, startTime:startTime)
            },
            error: { ( fault : Fault!) -> () in
                print("Server reported an error: \(fault)")
            }
        )
    }
    
    func nextPageAsync(bc: BackendlessCollection, startTime: NSDate) {
        
        let size = bc.getCurrentPage().count
        if size == 0 {
            print("Total time (ms) - \(1000*NSDate().timeIntervalSinceDate(startTime))")
            return
        }
        
        print("Loaded \(size) objects in the current page")
        let currentPage = bc.getCurrentPage() as! [PEvents]
        for event in currentPage {
            if event.b_publisher != nil {
                print(event.b_publisher?.email)
            }
        }
        
        bc.nextPageAsync(
            { ( result : BackendlessCollection!) -> () in
                self.nextPageAsync(result, startTime:startTime)
            },
            error: { ( fault : Fault!) -> () in
                print("Server reported an error: \(fault)")
            }
        )
    }