get related object on NextPageAsync Call

when i’m calling NextPageAsync my related objects are empty how can i get the related objects here ??? my codes :
// here i’m making my first call for first page with normal find method :

let dataStore = backendless.data.of(PEvents) 
dataQuery.queryOptions.pageSize(5) 
dataQuery.queryOptions.related = ["b_publisher"] 
dataStore.find(dataQuery,..........
...
..

after getting first page i’m making call for nextPage:

self.fetchResults = result // here fetchResults is first Request's response 


fetchResults.nextPageAsync( { (nextResult : BackendlessCollection!) in

and the result does not contains any related objects here

how to fix it ??

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)")
            }
        )
    }

      func loadNextPage(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") 
 
// loadNextPage(bc,startTime: NSDate()) 
 
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.loadNextPage(result, startTime:startTime) 
 
 
 
print(result) /// I WANT MY RELATED OBJECT HERE STILL NO RELATED OBJECTS ARE HERE. 
 
}, 
 
error: { ( fault : Fault!) -> () in 
 
print("Server reported an error: \(fault)") 
 
} 
 
) 
 
}


are you getting what i’m trying to say ?? cause i’m stuck here man from past 2 days ,your sample project is also showing relation on first call not on NEXTPAGEASYNC CALL

here’s the output of your Sample App

Total objects - 27


Loaded 5 objects in the current page

Optional("billionbucks1@gmail.com")

Optional("billionbucks1@gmail.com")

Optional("billionbucks1@gmail.com")

Optional("billionbucks1@gmail.com")

Optional("billionbucks1@gmail.com")

Loaded 5 objects in the current page

Loaded 5 objects in the current page

Loaded 5 objects in the current page

Loaded 5 objects in the current page

Loaded 2 objects in the current page

Total time (ms) - 54714.065015316

the above is showing Email only on first Page not is nextPages (AND THAT IS MY PROBLEM)

Please, check our sample project without any changes - how do it work for you? Could you provide a screenshot of log?

yeah i’m sending it on your mail , can you please turn down this comment of yours which contains user’s mail ids