Facebook iOS SDK 4.2.0 - Error when sharing self-hosted Open Graph story -


i've been struggling last couple of days , can't seem find solution.

here problem: trying publish open graph story ios app , let facebook scrape provided url additional open graph tags. worked in previous sdk (3.x) life of me can't figure out why stopped working 4.2.0.

the error getting this:

object missing required value: object @ url 'http://samples.ogp.me/487842374583398' of type 'routieapp:activity' invalid because required property 'og:title' of type 'string' not provided.

i've included sample opengraph page of open graph action provided facebook see if problem in live website contains tags, clearly, since fails site, not case.

you can see source of sample website indeed contains open graph tags:

<meta property="fb:app_id" content="202373013130337" /> <meta property="og:title" content="sample activity" /> <meta property="og:image" content="https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png" /> <meta property="og:url" content="http://samples.ogp.me/487842374583398" /> <meta property="og:type" content="routieapp:activity" /> 

here code using initiate sharing:

fbsdkshareopengraphobject *object = [fbsdkshareopengraphobject objectwithproperties:@{@"og:url": @"http://samples.ogp.me/487842374583398", @"og:type": @"routieapp:activity"}];   fbsdkshareopengraphaction *action = [[fbsdkshareopengraphaction alloc] init]; action.actiontype = @"routieapp:track";  [action setstring:[gsdateformatter iso8601stringfromdate:[route.startlocation timestampasdate]] forkey:@"start_time"]; [action setstring:[gsdateformatter iso8601stringfromdate:[route.endlocation timestampasdate]] forkey:@"end_time"]; nstimeinterval duration = [[route.endlocation timestampasdate] timeintervalsincedate:[route.startlocation timestampasdate]]; [action setnumber:@(duration) forkey:@"activity_duration"];  [action setobject:object forkey:@"routieapp:track"];  fbsdkshareopengraphcontent *content = [[fbsdkshareopengraphcontent alloc] init]; content.action = action; content.previewpropertyname = @"routieapp:track";  fbsdkshareapi *shareobject = [[fbsdkshareapi alloc] init]; shareobject.sharecontent = content; shareobject.message = route.name; shareobject.delegate = self; [shareobject share];  [fbsdkshareapi sharewithcontent:content delegate:self]; 

now regarding open graph setup: track action , activity object.

any ideas how solve this? i'd thrilled! because i've been hitting wall week , i've run out of ideas. (people on stack overflow) last hope! thank in advance.

solved! :)

but wouldn't believe problem turned out be. line:

[action setnumber:@(duration) forkey:@"activity_duration"]; 

caused all. there no activity_duration parameter when comes actions. it's shame error message wasn't more descriptive.

also, if need share open graph object, there better way did in code in question - can use method:

fbsdkshareopengraphaction *action = [fbsdkshareopengraphaction actionwithtype:@"routieapp:track" objecturl:objecturl key:@"routieapp:activity"]; 

Comments