操作无法完成 com.facebook.sdk 错误 3 - IOS-react-native-FBSDK
Posted
技术标签:
【中文标题】操作无法完成 com.facebook.sdk 错误 3 - IOS-react-native-FBSDK【英文标题】:operation could not be completed com.facebook.sdk error 3 - IOS-react-native-FBSDK 【发布时间】:2018-12-09 06:53:23 【问题描述】:我遇到了 facebook 登录问题operation could not be completed com.facebook.sdk error 3
我没有任何线索可以解决这个问题。附上我的 Info.plist、Appdelidate.m 和我的按钮的代码 sn-ps
这是我的 Info.plist 文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>myappname</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSAppTransportSecurity</key>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<!-- For Facebook -->
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb1922460507874734</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>1922460507874734</string>
<key>FacebookDisplayName</key>
<string>MyappnamefromFacebook</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fb</string>
<string>fbapi</string>
<string>fbauth2</string>
<string>fbshareextension</string>
<string>fb-messenger-api</string>
</array>
</dict>
</plist>
还有我的 AppDelegate.m 文件
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKShareKit/FBSDKShareKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"myappname"
initialProperties:nil
launchOptions:launchOptions];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [[UIViewController alloc] init];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
// return YES;
return [[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
// return YES;
- (void)applicationDidBecomeActive:(UIApplication *)application
[FBSDKAppEvents activateApp];
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
];
// Add any custom logic here.
// return handled;
@end
最后是我的按钮
<LoginButton
onLoginFinished=
(error, result) =>
if (error)
// alert(result)
alert("Login failed with error: " + error.message);
else if (result.isCancelled)
alert("Login was cancelled");
else
alert("Login was successful with permissions: " + result.grantedPermissions)
onLogoutFinished=() => alert("User logged out")/>
上面的代码当前显示按钮,单击按钮时会抛出错误并附加错误消息。
这也是我关于 IOS 平台的 Facebook 仪表板
【问题讨论】:
【参考方案1】:FBSDK 4.39.0 版似乎有问题,更新以下版本解决了我的问题
pod 'FBSDKCoreKit', '~> 4.38.1'
pod 'FBSDKLoginKit', '~> 4.38.1'
pod 'FBSDKShareKit', '~> 4.38.1'
【讨论】:
【参考方案2】:根据他们的 repo https://github.com/facebook/facebook-objc-sdk/releases,4.38 被标记为最新版本。提交历史记录中有 URL 编码/解码更改。 URL 在 4.39 版本中被破坏,这就是为什么 4.39 不是最新的推荐版本,但它仍在 podspec 中。
pod 'FBSDKCoreKit', '4.38.0'
pod 'FBSDKLoginKit', '4.38.0'
【讨论】:
以上是关于操作无法完成 com.facebook.sdk 错误 3 - IOS-react-native-FBSDK的主要内容,如果未能解决你的问题,请参考以下文章
出现错误'操作无法完成。 (com.facebook.sdk 错误 5.)' 从 iphone 在 facebook 上发布视频时
操作无法完成。 (com.facebook.sdk.core 错误 3。)
FB ios SDK 3.13.1 操作无法完成(com.facebook.sdk 错误2)
操作无法完成 com.facebook.sdk 错误 3 - IOS-react-native-FBSDK
登录 facebook 时无法完成操作。(com.facebook.sdk 错误 2.0)错误。 iOS 6,iPhone3gs