Swift and Facebook SDK 4, Graph API -


trying put facebook integration trial app i'm working on , can't seem find efficient way make friends list small profile pic fb beside them. works flawless lengthy wait times on data fetch. please speed image fetch times. takes 10 seconds fetch.

func facebookprofilepicrequest(){             let graphconnection = fbsdkgraphrequestconnection()             result in self.facebookfriends {                 if let resultingid = result["id"] as? string{                      let profilepicrequest = fbsdkgraphrequest(graphpath: "/\(resultingid)/picture?redirect=false", parameters: nil)                     graphconnection.addrequest(profilepicrequest){                         (connection:fbsdkgraphrequestconnection!, result:anyobject!, error:nserror!) -> void in                           if(error != nil){                             if error.code == 1009{                                 println("no internet connection, \(error.code))")                             }                         }else{                             if let data: nsdictionary = result as? nsdictionary{                                 if let urldictionary: nsdictionary = data["data"] as? nsdictionary{                                     if let urlstring: nsstring = urldictionary["url"] as? nsstring{                                         let url: nsurl = nsurl(string: urlstring string)!                                         var request1: nsurlrequest = nsurlrequest(url: url)                                         let queue:nsoperationqueue = nsoperationqueue()                                         nsurlconnection.sendasynchronousrequest(request1, queue: queue, completionhandler:{ (response: nsurlresponse!, data: nsdata!, error: nserror!) -> void in                                             if error == nil{                                                 self.facebookfriendsimages.append(data)                                                 self.tableview.reloaddata()                                             }                                         })                                     }                                 }                             }                         }                     }                 }             }             graphconnection.start()         } 

instead of fetching images yourself, use facebook provided fbsdkprofilepictureview. have set user profile id, , load picture you.

this should improve things doesn't have wait images loaded before showing them, , load them asynchronously scroll tableview.


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -