Cache Facebook Profile Picture iOS -


i'm saving images disk app users, either upload picture or connect facebook , display profile picture.

this works great, if user changes facebook profile picture, code below never updates image.

how can check facebook graph api check if image has been uploaded without redownloading image? using afnetworking checking 302 header option if possible-just not sure how implement.

//load image if exists on disk      nsfilemanager *filemanager = [nsfilemanager defaultmanager];     nsstring *documentspath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) firstobject];     nsstring *filepath = [documentspath stringbyappendingpathcomponent:uniquecustomerpath];     bool fileexists = [filemanager fileexistsatpath:filepath];     if(fileexists){         uiimage* tempimage = [uiimage imagewithcontentsoffile:filepath];         completionhandler(tempimage);     }  //download image if not     else{                             nsstring *imageurl=[nsstring stringwithformat:@"https://graph.facebook.com/%@/picture?type=large", (long)self.customer.facebook_id];             uiimage *tempimage = [uiimage imagewithdata:[nsdata datawithcontentsofurl:[nsurl urlwithstring:imageurl]]];             nsdata *mydata = uiimagejpegrepresentation(tempimage, 1);                             [mydata writetofile:filepath atomically:yes];             completionhandler(tempimage);         } 


Popular posts from this blog

javascript - Js, document.getElementById("ID").innerHTML, error -

objective c - Is there a way in OCMockito to make stubs fail when an unknown method is called? -

jquery - jqGrid update specific column data with out refreshing the entire column? -