ios - CKQueryOperation and UICollectionView -


i endeavouring make 1 of apps more efficient user. fetch record of booklets, i.e. name, image of cover , booklet itself, name , image being utilised in collection view , booklet (pdf) being utilised in detailsviewcontroller. code -

   func fetchdocuments() {          let container = ckcontainer.default()         let publicdatabase = container.publicclouddatabase         let predicate = nspredicate(format: "truepredicate")         let query = ckquery(recordtype: "booklets", predicate: predicate)         query.sortdescriptors = [nssortdescriptor(key: "creationdate", ascending: true)]         publicdatabase.perform(query, inzonewith: nil) { (results, error) -> void in             if (error != nil) {                 dispatchqueue.main.async() {                     self.notifyuser("cloud access error", message: error!.localizeddescription)                 }             } else {                 print("success")                 result in results! {                     self.bookletarray.append(result)                     print(result)                 }                 operationqueue.main.addoperation({ () -> void in                    self.collectionview.reloaddata()                 })             }         }     } 

as works well, download of booklet files (pdf's) causes delay. have endeavoured use code have utilised in other scenes use uitableviews , works them. when endeavour use code collection view, no data (name or image) presented , no apparent errors. selected documents code -

func fetchselecteddocuments() {     let container = ckcontainer.default()     let publicdatabase = container.publicclouddatabase     let predicate = nspredicate(format: "truepredicate")     let query = ckquery(recordtype: "booklets", predicate: predicate)     let queryoperation = ckqueryoperation(query: query)     queryoperation.desiredkeys  = ["booklettitle", "bookletimage"]     queryoperation.recordfetchedblock = { (record:ckrecord) -> void in         let result = record         self.bookletarray.append(result)         print(result)     }     queryoperation.querycompletionblock = { (cursor:ckquerycursor?, error: error?) -> void in         if (error != nil) {             self.notifyuser("cloud access error", message: error!.localizeddescription)              operationqueue.main.addoperation({ () -> void in                 self.collectionview.reloaddata()             })         }     }     publicdatabase.add(queryoperation) } 

i'm unsure why works uitableview , not uicollectionview , advice or hints appreciated.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -