objective c - how to share screenshot to Facebook -
i've done screenshot part, still haven't found solution share screenshot image facebook using fbsdksharephoto. facebook doesn't provide enough references it. can please guide me here?
here screenshot code in case:
cgrect screenrect = [[uiscreen mainscreen] bounds]; uigraphicsbeginimagecontextwithoptions(screenrect.size, no , 0.0f); cgcontextref ctx = uigraphicsgetcurrentcontext(); [[uicolor blackcolor] set]; cgcontextfillrect(ctx, screenrect); uiwindow *window = [uiapplication sharedapplication].keywindow; [window.layer renderincontext:ctx]; uiimage *screengrab = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();
i believe want fbsdksharephotocontent , fbsdksharedialog. need setup content photo(s):
uiimage *screengrab = uigraphicsgetimagefromcurrentimagecontext(); fbsdksharephotocontent *content = [[fbsdksharephotocontent alloc] init]; content.photos = @[[fbsdksharephoto photowithimage:screengrab usergenerated:yes]]; // assuming self implements <fbsdksharingdelegate> [fbsdkshareapi sharewithcontent:content delegate:self];
Comments
Post a Comment