我正在使用Facebook的iOS SDK 3.20为我的iOS应用添加类似按钮。我遇到的问题是,点击按钮后(然后点击提出的确认屏幕上的确定按钮),用户的Facebook页面上不会显示任何帖子。
现在,我花了一段时间才到达确认消息出现的地方而不是某种类型的错误消息。我不得不通过Facebook审核我的应用程序,请求" Native Like Button"许可,然后公开我的Facebook应用程序。
我已经查看过"入门"指南和Facebook SDK附带的示例应用程序多次,我唯一不同的是将FBLikeControl的objectID设置为我选择的URL(公司网站)。这是我的代码:
FBLikeControl* like = [FBLikeControl alloc] init];
like.likeControlStyle = FBLikeControlStyleButton;
like.objectID = @"http://mycompany.com";
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:like];
我的所有测试都是使用XCode Simulator完成的,因此在点击“赞”按钮后,Web浏览器会显示确认信息。我现在唯一的猜测是Facebook的应用程序的开发者网站上没有设置某些内容。
此外,在完成所有测试后,我不再看到确认网页。浏览器只是短暂显示,并将我重定向回应用程序。如果有帮助,点击“赞”按钮后会有一些记录:
2014-11-24 17:31:24.358 4MyCabPremium[23014:90b] FBSDKLog: FBAppEvents Persist: Writing 4 events
2014-11-24 17:31:25.933 4MyCabPremium[23014:90b] FBSDKLog: FBAppEvents Persist: Read 4 events
2014-11-24 17:31:25.933 4MyCabPremium[23014:90b] FBSDKLog: FBAppEvents Persist: Clearing
2014-11-24 17:31:25.934 4MyCabPremium[23014:90b] FBSDKLog: FBTimeSpentData Restore: {"secondsSpentInCurrentSession":93,"lastSuspendTime":1416873520,"numInterruptions":1}
2014-11-24 17:31:26.137 4MyCabPremium[23014:90b] FBSDKLog: Dynamically loaded library at /System/Library/Frameworks/AdSupport.framework/AdSupport
2014-11-24 17:31:26.137 4MyCabPremium[23014:90b] FBSDKLog: Request <#1125>:
URL: https://graph.facebook.com/v2.2/374418562723727/activities?sdk=ios&advertiser_tracking_enabled=1&bundle_id=com.testapp.liketest&format=json&application_tracking_enabled=1&bundle_version=1.13&event=CUSTOM_APP_EVENTS&url_schemes=%5B%22fb374418562723727%22%5D&advertiser_id=XZF430BA2E-324F-4A4C-95E0-7FC0AD36F3FE&bundle_short_version=13
Method: POST
UserAgent: FBiOSSDK.3.20.0
MIME: multipart/form-data; boundary=3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f
Body Size: 0 kB
Attachments:
sdk: ios
advertiser_tracking_enabled: 1
bundle_id: com.testapp.liketest
format: json
application_tracking_enabled: 1
bundle_version: 1.13
event: CUSTOM_APP_EVENTS
url_schemes: ["fb374418562723727"]
advertiser_id: XZF430BA2E-324F-4A4C-95E0-7FC0AD36F3FE
bundle_short_version: 13
custom_events_file: <Data - 0 kB>
2014-11-24 17:31:26.138 4MyCabPremium[23014:90b] FBSDKLog: FBURLConnection <#1128>:
URL: 'https://graph.facebook.com/v2.2/374418562723727/activities?sdk=ios&advertiser_tracking_enabled=1&bundle_id=com.testapp.liketest&format=json&application_tracking_enabled=1&bundle_version=1.13&event=CUSTOM_APP_EVENTS&url_schemes=%5B%22fb374418562723727%22%5D&advertiser_id=XZF430BA2E-324F-4A4C-95E0-7FC0AD36F3FE&bundle_short_version=13'
2014-11-24 17:31:26.240 4MyCabPremium[23014:90b] FBSDKLog: FBURLConnection <#1128>:
Duration: 102 msec
Response Size: 0 kB
MIME type: application/json
2014-11-24 17:31:26.240 4MyCabPremium[23014:90b] FBSDKLog: Response <#1125>
Duration: 102 msec
Size: 16 kB
Response Body:
(
{
body = {
success = 1;
};
code = 200;
}
)
2014-11-24 17:31:26.240 4MyCabPremium[23014:90b] FBSDKLog: FBAppEvents: Flushed @ 1416879086, 4 events due to 'PersistedEvents' - {
"advertiser_id" = "XZF430BA2E-324F-4A4C-95E0-7FC0AD36F3FE";
"advertiser_tracking_enabled" = 1;
"application_tracking_enabled" = 1;
"bundle_id" = "com.testapp.liketest";
"bundle_short_version" = 13;
"bundle_version" = "1.13";
event = "CUSTOM_APP_EVENTS";
"url_schemes" = "[\"fb374418562723727\"]";
}
Events: [
{
"horizontal_alignment" : "left",
"_logTime" : 1416879071,
"object_id" : "http:\/\/mycompany.com",
"sound_enabled" : true,
"_implicitlyLogged" : "1",
"_ui" : "no_ui",
"style" : "button",
"auxiliary_position" : "inline",
"_eventName" : "fb_like_control_impression"
},
{
"horizontal_alignment" : "left",
"_logTime" : 1416879084,
"object_id" : "http:\/\/mycompany.com",
"sound_enabled" : true,
"_implicitlyLogged" : "1",
"_ui" : "no_ui",
"style" : "button",
"auxiliary_position" : "inline",
"_eventName" : "fb_like_control_did_tap"
},
{
"horizontal_alignment" : "left",
"_logTime" : 1416879084,
"object_id" : "http:\/\/mycompany.com",
"sound_enabled" : true,
"_implicitlyLogged" : "1",
"_ui" : "no_ui",
"style" : "button",
"auxiliary_position" : "inline",
"_eventName" : "fb_like_control_did_present_dialog"
},
{
"fb_dialog_outcome" : "Completed",
"_logTime" : 1416879084,
"_eventName" : "fb_dialogs_present_like_og",
"_implicitlyLogged" : "1",
"_ui" : "no_ui"
}
]
Flush Result : Success
提前感谢任何可以帮助解决此问题的人。