我尝试使用facebook opengraph显示地图。 所以我有一个facebook故事
在我的代码中,我创建了对象
var properties:NSDictionary = ["og:type": "myplanetnamespace:plan", "og:title": "Share on Facebook выа", "og:description": "In the frozen wastes to the north of Winterfell, sinister and supernatural forces are mustering.",
"myplanetnamespace:geoplace:latitude": String(stringInterpolationSegment: self.plan.venue!.location.latitude),
"myplanetnamespace:geoplace:longitude": String(stringInterpolationSegment: self.plan.venue!.location.longitude) ]
var object:FBSDKShareOpenGraphObject = FBSDKShareOpenGraphObject(properties: properties as [NSObject : AnyObject])
行动
var action = FBSDKShareOpenGraphAction()
action.actionType = "myplanetnamespace:create_plan"
action.setObject(object, forKey: "plan")
内容
var content:FBSDKShareOpenGraphContent = FBSDKShareOpenGraphContent()
content.action = action
content.previewPropertyName = "plan"
而不是对话
var shareDialog = FBSDKShareDialog()
shareDialog.fromViewController = self
shareDialog.shareContent = content
if ( shareDialog.canShow() == true ){
shareDialog.show()
}
var error:NSError?
if(!shareDialog.validateWithError(&error)){
print ("error")
}
我根据需要设置了location属性,并且没有错误。我试图发帖子,但它创建它没有任何地图=((
答案 0 :(得分:0)
geoplace
来自哪里?这不是Facebook Open Graph的一部分,是吗?你能做这样的事吗:
[openGraphObject setObject:@{@"latitude": String(stringInterpolationSegment: self.plan.venue!.location.latitude),
@"longitude": String(stringInterpolationSegment: self.plan.venue!.location.longitude)]}
forKey:@"location"];