回到2016年12月,我的iOS应用程序仍然运行良好。但现在我发现共享功能不起作用。在我的源代码中没有什么改变
这是我从设备控制台获得的日志:
2月13日23:16:48 duc-lans-iPad Facebook3787:-canOpenURL: failed:错误:“此应用程序不允许查询方案fb123123123”2月13日23:16:48 duc-lans-iPad mediaserverd2389:'‘com.facebook.Facebook(pid = 3787)设置DiscoveryMode = DiscoveryMode_None,currentDiscoveryMode = DiscoveryMode_None Feb 13 23:16:48 duc-lans-iPad mediaserverd2389:‘com.facebook.Facebook(pid = 3787)设置DiscoveryMode = DiscoveryMode_None,currentDiscoveryMode = DiscoveryMode_None Feb 13 23:16:48 duc-lans-iPad AppName3837 : FB: ERROR=Error Domain=com.facebook.Facebook.platform Code=102 (空)“UserInfo={error_code=102,error_description=An错误发生在发布过程中,app_id=123123123,error_reason=The操作无法完成。(FBAPIErrorDomain错误100.)} 2月13日23:16:49 duc-lans-iPad AppName3837 : ViewController::didBecomeActive Fe13 23:16:49 duc-lans-iPad Facebook3787 : CoreBluetooth API误用:只能在开机状态下接受此命令。
我在Facebook的代表里拿了一个NSLog,下面的结果是:
2017-02-13 23:16:48.946 AppName3837:2839472 FB: ERROR=Error Domain=com.facebook.Facebook.platform Code=102 "(null)“UserInfo={error_code=102,在发布过程中发生error_description=An错误,app_id=123123123,error_reason=The操作无法完成。(FBAPIErrorDomain错误100.)}
我比较了Facebook设置下的DisplayName和.plist设置,它们是一样的。
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];
这是怎么回事?谢谢!
发布于 2017-04-11 05:20:25
我研究这个问题。我想知道如何设置Facebook开发者门户,
转到Facebook开发者门户下的应用程序设置。转到“打开图形”>“类型”,选择使用该操作类型的动作类型,并为该动作类型打开“用户生成的图像”。保存这些设置,然后重试。看起来不错。
参考:( SarpErdag ) https://stackoverflow.com/a/17681364/5349267
https://stackoverflow.com/questions/42207155
复制相似问题