ios - Sharing fb image and message content within the app not working using FBSDKShareDialog -
i using following code share picture , message on fb timeline using fbsdk open graph object , fbsdk open graph content.however following code nothing,no dialog presented nor post timeline.am missing in code or code not work in simulator?
- (ibaction)sharebuttonpressed:(id)sender { nsstring *contentdesc=@"abcdcccdcc"; nsstring *title=[nsstring stringwithformat:@"%@ \n asd %@, asd %@",self.namelabel.text,_fromdate.text,_todate.text]; fbsdksharephoto *photo = [[fbsdksharephoto alloc] init]; photo.image = _profilepic.image; photo.usergenerated = yes; // create object nsdictionary *properties = @{ @"og:type": @"memories.memory", @"og:title":title , @"og:description":contentdesc }; fbsdkshareopengraphobject *object = [fbsdkshareopengraphobject objectwithproperties:properties]; // create action fbsdkshareopengraphaction *action = [[fbsdkshareopengraphaction alloc] init]; action.actiontype = @"memories.view"; [action setobject:object forkey:@"memories.memory"]; // add photo action [action setphoto:photo forkey:@"image"]; // create content fbsdkshareopengraphcontent *content = [[fbsdkshareopengraphcontent alloc] init]; content.action = action; content.previewpropertyname = @"memories.memory"; [fbsdksharedialog showfromviewcontroller:self withcontent:content delegate:nil]; }
in delegate method
-(void)sharer:(id<fbsdksharing>)sharer didfailwitherror:(nserror *)error { nslog(@"%@",error); }
the error log printed follows
error domain=com.facebook.sdk.share code=2 "the operation couldn’t completed. (com.facebook.sdk.share error 2.)" userinfo=0x7faec97bb660 {com.facebook.sdk:fbsdkerrorargumentvaluekey=<fbsdkshareopengraphcontent: 0x7faecbc16740>, com.facebook.sdk:fbsdkerrordevelopermessagekey=feed share dialogs support fbsdksharelinkcontent., com.facebook.sdk:fbsdkerrorargumentnamekey=sharecontent}
change [action setphoto:photo forkey:@"image"];
[object setphoto:photo forkey:@"og:image"];
Comments
Post a Comment