问题
My goal is to achieve something along the lines of this without implementing a backend web server:
currently, I am using this code:
id<FBOpenGraphAction> _action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
_action[@"book"] = @{
@"type":@"books.book",
@"fbsdk:create_object": @YES,
@"title":@"test title 1",
@"url":@"http://test-test.test",
@"image":@"http://www.m5zn.com/uploads/2010/7/15/photo/071510030742woekhs48rdt1ifcwp.jpg",
@"description": @"development in progress - test description",
@"data": @{@"isbn":@"0-316-31696-2"}
};
[FBSettings enableBetaFeature:FBBetaFeaturesOpenGraphShareDialog];
[FBDialogs presentShareDialogWithOpenGraphAction:_action
actionType:@"books.reads"
previewPropertyName:@"book"
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
NSLog(@"Error: %@", error.description);
} else {
NSLog(@"Success!");
}
}];
Nothing is being logged when that code is run. Additionally, here is the AppDelegate fragment:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
// attempt to extract a token from the url
return [FBAppCall handleOpenURL:url sourceApplication:sourceApplication withSession:FBSession.activeSession fallbackHandler:^(FBAppCall *call) {
DLog(@"in fallback handler");
}];
// return [FBSession.activeSession handleOpenURL:url];
}
I attempted to follow this example: https://www.youtube.com/watch?v=mLuaUtbGvEM#at=322 Found at the end of this article: https://developers.facebook.com/docs/opengraph/using-object-api/
Yet the share dialogue does not come up, and nothing is logged in the console. What went wrong? Are there some dependencies that I'm missing? Is my view controller not complying with certain protocols? Are certain handlers not invoked? W
What is additionally necessary to get this to work?
来源:https://stackoverflow.com/questions/17483568/facebook-ios-sdk-creating-user-owned-objects-and-publishing-an-open-graph-stor