3
我試圖在我的應用程序中使用Facebook進行簽入,我創建了故事,操作和對象類型。 Facebook給了我的代碼:使用圖表簽入Facebook
NSMutableDictionary<FBGraphObject> *object =
[FBGraphObject openGraphObjectForPostWithType:@"restaurant.restaurant"
title:@"Sample Restaurant"
image:@"https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png"
url:@"http://samples.ogp.me/440002909390231"
description:@"This place rocks"];;
[FBRequestConnection startForPostWithGraphPath:@"me/objects/restaurant.restaurant"
graphObject:object
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
// handle the result
}];
但它不工作。
我已經試過了太:
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
@"302184056577324", @"fb:app_id",
@"restaurant.restaurant", @"og:type",
@"http://samples.ogp.me/440002909390231", @"og:url",
@"Sample Restaurant", @"og:title",
@"https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png", @"og:image",
@"This place rocks", @"og:description",
@"1601 Willow Rd.", @"restaurant:contact_info:street_address",
@"Menlo Park", @"restaurant:contact_info:locality",
@"California", @"restaurant:contact_info:region",
@"94025", @"restaurant:contact_info:postal_code",
@"United States", @"restaurant:contact_info:country_name",
@"[email protected]", @"restaurant:contact_info:email",
@"212-555-1234", @"restaurant:contact_info:phone_number",
@"http://www.facebook.com", @"restaurant:contact_info:website",
@"37.484828", @"place:location:latitude",
@"-122.148283", @"place:location:longitude",
nil
];
/* make the API call */
[FBRequestConnection startWithGraphPath:@"me/myapp:check_in"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
DBLog(@"result: %@", result);
DBLog(@"error: %@", error);
}];
}
兩個代碼不能正常工作,任何人都可以幫助我嗎?
感謝
你收到了什麼錯誤? – MCMatan
error = { code = 1; message =「發生未知錯誤。」; type = OAuthException; }; –
你檢查過FBSession是否打開? – MCMatan