How to post location with image to facebook in IOS? -



How to post location with image to facebook in IOS? -

i trying share location along image facebook. have shared image unable share location. below code of sharing image.

uiimage *facebookimage = [uiimage imagewithdata:[nsdata datawithcontentsofurl:[nsurl urlwithstring:[nsstring stringwithformat:@"%@%@",imagesurl,str]]]]; nsmutabledictionary* params = [[nsmutabledictionary alloc] init]; [params setobject:@"new happening created on happenshare mobile app." forkey:@"message"]; [params setobject:facebookimage forkey:@"picture"]; [fbrequestconnection startwithgraphpath:@"me/photos" parameters:params httpmethod:@"post" completionhandler:^(fbrequestconnection *connection,id result,nserror *error) { if (error) { nslog(@"error : %@",error); } else { nslog(@"result : %@",result); } }];

now sharing location parameter should add together in above code. attaching image understand improve how shared location like.below image shows how image text indicate location map. please suggest me solution that.

along "message" , need "place" id post param.

request "publish_actions" can post place/location.

below code i've used:

nsmutabledictionary *params = [nsmutabledictionary dictionary]; [params setobject:@"hello world" forkey:@"message"]; [params setobject:@"110503255682430"/*sample place id*/ forkey:@"place"]; [[[fbsdkgraphrequest alloc] initwithgraphpath:@"/me/feed" parameters:params httpmethod:@"post"] startwithcompletionhandler:^(fbsdkgraphrequestconnection *connection, id result, nserror *error) { nslog(@"result %@",result); nslog(@"error %@",error); }];

you can check "administrator/tester" accounts given in developer page -> app -> roles. utilize graph explorer improve practice: https://developers.facebook.com/tools/explorer/108895529478793?method=post&path=me%2ffeed%3f&version=v2.5&message=hello%20world&place=110503255682430

below code may help in getting place id near location:

nsmutabledictionary *params2 = [nsmutabledictionary dictionarywithcapacity:4l]; [params2 setobject:[nsstring stringwithformat:@"%@,%@",yourlocation latitude,yourlocation longitude] forkey:@"center"]; //hard code coordinates test [params2 setobject:@"place" forkey:@"type"]; [params2 setobject:@"100"/*meters*/ forkey:@"distance"]; [[[fbsdkgraphrequest alloc] initwithgraphpath:@"/search" parameters:params2 httpmethod:@"get"] startwithcompletionhandler:^(fbsdkgraphrequestconnection *connection, id result, nserror *error) { nslog(@"response!!! /search"); }];

or

[[[fbsdkgraphrequest alloc] initwithgraphpath:@"/search?type=place&center=yourlocationlat,yourlocationlong&distance=500" parameters:nil httpmethod:@"get"] startwithcompletionhandler:^(fbsdkgraphrequestconnection *connection, id result, nserror *error) { nslog(@"result %@",result); }];

hope helps you..

ios facebook location sharing

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -