Has anyone realized a share for a fitness course with Facebook SDK 4.2.0? I have a track of CLLocation objects in an array and would like to share this as a course in Facebook. Duration and distance is shown, but no track on the map. That means, my problem is to realize the fitness:metric:location section. Any help?
Here is my source code, very simple. All I want is adding some more locations to show the track. But NSDictionary is not allowing multiple entries for the same key, so adding it to properties is not possible.
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSDictionary *properties = @{
@"og:type": @"fitness.course",
@"og:title": @"YapYap Track",
@"og:description": @" ",
@"fitness:duration:value": appDelegate.actEvent.nDurationInSeconds,
@"fitness:duration:units": @"s",
@"fitness:distance:value": [NSNumber numberWithDouble:appDelegate.actEvent.nTracklengthInMeter.doubleValue/1000.0],
@"fitness:distance:units": @"km",
@"fitness:speed:value": [NSNumber numberWithDouble:appDelegate.actEvent.nTracklengthInMeter.doubleValue/appDelegate.actEvent.nDurationInSeconds.doubleValue],
@"fitness:speed:units": @"m/s",
@"fitness:metrics:location:latitude": appDelegate.actEvent.lat,
@"fitness:metrics:location:longitude": appDelegate.actEvent.lon,
};
FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];
FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
action.actionType = @"fitness.walks";
[action setObject:object forKey:@"fitness:course"];
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = @"fitness:course";
[FBSDKShareDialog showFromViewController:self withContent:content delegate:self];
NSMutableDictionary
instead ofNSDictionary
?NSMutableDictionary
should allow non-unique keys; it's not clear how FBSDKShareOpenGraphObject will handle taking a subclass instead of NSDictionary but it may be OK