ios9

时间:2017-02-13 15:03:43

标签: ios facebook ios9 fbsdk

回到2016年12月,我的iOS应用程序仍然正常运行。 但现在我发现共享功能不起作用。 我的源代码中没有任何变化

这是我从设备控制台获取的日志:

  

2月13日23时十六分48秒DUC-局域网-ipad公司的Facebook [3787]:-canOpenURL:失败URL:" fb123123123://桥/股密= AZpZOY%2BS6YXHfhtlqhaCH2l5dfoAnuTBZbNpwXODLhCIncH1CSahDjHaMOv2UMeIFtFs5l1xw1%2Bs4ZPM40rsKKCfnxdvn2HhOHkPRWZXVlGGapfRMFAOriQjNdv8IwOQ%2FKT84S%2BujvmSPcUOXR24Ss5oSrK19sHQHfWpF7xe28az4MRGAfjE9Jh7 %2BCMBI8YtLdLSqp7v%2FW4DDECHztrXrI%2BFi9aV1u0pyLlJ3C8CEJWbm3dl903od6gxU9ErC39wZzsIMH7Fq1fK4cgjYj%2B8x0MLZ1qhQnKz1OmS5a%2FjyXSY7hWHLuvYogRO3LcmzDmdujSaahv%2BhXSbwGeO0cVhp4bT58EH4xzRjDi1HqhoYSqxJojKkSP53zShdNTsLP2iVySRMl4Da58ApbFq0YfLK7APtWmdQ676JQOjO33ole24LHDo%2FyjIfp%2FUukhOUj%2BJ7S2g4sNaQ1amRrYI9pTc7m6y0KEEzsvDJ9BR9o%2FaQ%2F6dvDUeHhhel4SIfd6g6so%2FS05J2VeztSVlLJqVZnUHD6DkOI%2BvOqA1QyVr09I02%2F0HtC%2BOTLg3VZATfMeXPiiXEo%2BMqgknJvyS89UFk7xUIPw7toVurM84jIb6YeNRLxpbH55Axv%2FpQJqmyQQ443GA2M72Y0q1p7wDghBR7XinIiXCeIlj%2FcxDBmHzB9IIk9GmtRCtum5pQET%2B%2BRs0FT7mE2epZvKhPEdpGSAN6SwC%2Fd4QEGlPDbM10On6z9x6gV%2BKTzWAchy2glpXGq6NBJcrSLo8XlH%2FPt80OP3iHVpsrBKkrh5GP2kRir%2BETr3b7%2FLXWJJgP6ScuiPj w1EmKwHQwvb%2FZqn756xXFcDbu7%2Ba8wTQUvF8bWs8bNcJpjnubN%2Fs6jWQ0cBN40Ke5k819NPr5ecRska1ESC1TPclug64KWlnOqB6aqF4gRXSDkg9uvAoVu5QIEFRtrZJZOzOKaV1sQNTrscf8Buw566c0YPwudovgFTUV1%2FD9tFLm3hhYMcwN1uYO4fqdznCG6knhns98dOW0o%2B%2FkbS2H9QfR8rIZNhT%2FFpfQfUIuTYsvgLH5WrJORm%2BKT9mraUM8s29owcqc%2Bbn9kq4ma3T8nV5dy3fY6Com0vK7w%2BDMTT9ZyP0WKZDPsgDkM4i%2FawZrO6zE9OaWb0WWKpn3uHm8FGuqldMkP19xYxBuhO1a13bnCi3ulZu4uQpIg1e93zEHS3LUr6JjBFSZf61bb5wlJmNGal50Js%3D&安培;版本= 20130214" - 错误:"此应用程序不允许查询方案fb123123123"   2月13日23:16:48 duc-lans-iPad mediaserverd [2389]:'' com.facebook.Facebook(pid = 3787)设置DiscoveryMode = DiscoveryMode_None,currentDiscoveryMode = DiscoveryMode_None   2月13日23:16:48 duc-lans-iPad mediaserverd [2389]:'' com.facebook.Facebook(pid = 3787)设置DiscoveryMode = DiscoveryMode_None,currentDiscoveryMode = DiscoveryMode_None   2月13日23:16:48 duc-lans-iPad AppName [3837]:FB:ERROR = Error Domain = com.facebook.Facebook.platform Code = 102"(null)" UserInfo = {error_code = 102,error_description =发布时发生错误。,app_id = 123123123,error_reason =操作无法完成。 (FBAPIErrorDomain错误100。)}   2月13日23:16:49 duc-lans-iPad AppName [3837]:ViewController :: didBecomeActive   2月13日23:16:49 duc-lans-iPad Facebook [3787]:[CoreBluetooth] API MISUSE:只能在开机状态下接受此命令

我在Facebook代表中使用NSLog,结果如下:

  

2017-02-13 23:16:48.946 AppName [3837:2839472] FB:ERROR = Error Domain = com.facebook.Facebook.platform Code = 102"(null)" UserInfo = {error_code = 102,error_description =发布时发生错误。,app_id = 123123123,error_reason =操作无法完成。 (FBAPIErrorDomain错误100。)}

我在Facebook设置和.plist设置中比较了DisplayName,它们是相同的。

info.plist:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLName</key>
        <string></string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb123123123</string>
        </array>
    </dict>
</array>

<key>FacebookAppID</key>
<string>123123123</string>
<key>FacebookDisplayName</key>
<string>AppName</string>

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fb-messenger-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
    <string>line</string>
    <string>twitter</string>
</array>

源代码:

FBSDKShareLinkContent *content = [FBSDKShareLinkContent new];
NSString *stringURL = [NSString stringWithFormat:@"%@sharemovie?movie=%@", BASE_URL, [dict getStringFromKey:@"movieId"]];
content.contentURL = [NSURL URLWithString:stringURL];
content.contentTitle = [NSString stringWithFormat:@"%@abcabcabc",[dict objectForKey:@"movieCreator"]];
content.ref = stringURL;

FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
dialog.fromViewController = vc;
dialog.shareContent = content;
//    dialog.mode = FBSDKShareDialogModeShareSheet;
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fbauth2://"]]){
    dialog.mode = FBSDKShareDialogModeNative;
}
else {
    dialog.mode = FBSDKShareDialogModeBrowser; //or FBSDKShareDialogModeAutomatic
}
dialog.delegate = vc;
[dialog show];

它出了什么问题? 谢谢!

1 个答案:

答案 0 :(得分:0)

我研究这个问题。我开始了解在Facebook开发者门户网站中的设置,

转到Facebook开发人员门户网站下的应用设置。 转到打开图表&gt;类型 选择操作类型,然后为该操作类型启用“用户生成的图像”。保存这些设置,然后重试。它会起作用。

参考:( SarpErdag) https://stackoverflow.com/a/17681364/5349267