Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Fatter使用facebook登录_Ios_Xcode_Facebook Graph Api_Flutter - Fatal编程技术网

Ios Fatter使用facebook登录

Ios Fatter使用facebook登录,ios,xcode,facebook-graph-api,flutter,Ios,Xcode,Facebook Graph Api,Flutter,我正在尝试使用facebook登录我的用户。 因此,我使用以下代码: FacebookLoginResult facebookLoginResult = await _handleFBSignIn(); final accessToken = facebookLoginResult.accessToken.token; if (facebookLoginResult.status == FacebookLoginStatus.loggedIn) {

我正在尝试使用facebook登录我的用户。 因此,我使用以下代码:

 FacebookLoginResult facebookLoginResult = await _handleFBSignIn();
        final accessToken = facebookLoginResult.accessToken.token;
        if (facebookLoginResult.status == FacebookLoginStatus.loggedIn) {
          setState(() {
            isSaving = true;
          });

          final facebookAuthCred =
              FacebookAuthProvider.getCredential(accessToken: accessToken);
          final user =
              await firebaseAuth.signInWithCredential(facebookAuthCred);

          final graphResponse = await http.get(
              'https://graph.facebook.com/v4.0/me?fields=name,first_name,last_name,friends,email&access_token=$accessToken');
          final profile = jsonDecode(graphResponse.body);

          if (profile['id'] != null) {
            setState(() {
              facebookID = profile['id'];
            });
          }

  Future<FacebookLoginResult> _handleFBSignIn() async {
    FacebookLogin facebookLogin = FacebookLogin();
    FacebookLoginResult facebookLoginResult =
        await facebookLogin.logInWithReadPermissions(['email', 'user_friends']);
    switch (facebookLoginResult.status) {
      case FacebookLoginStatus.cancelledByUser:
        print("Cancelled");
        break;
      case FacebookLoginStatus.error:
        print("error");
        break;
      case FacebookLoginStatus.loggedIn:
        print("Logged In");
        break;
    }
    return facebookLoginResult;
  }
所以我假设它与我的info.plist有关,因为android没有这个问题。我查看了我的信息列表,但找不到任何东西

<?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>$(DEVELOPMENT_LANGUAGE)</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>drinkm8</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(FLUTTER_BUILD_NAME)</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>$(FLUTTER_BUILD_NUMBER)</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
    <key>NSCameraUsageDescription</key>
    <string>Hiermee kunt u een verhaal maken</string>
    <key>NSContactsUsageDescription</key>
    <string>Your prompt</string>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>Always/When in use description</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>Can I haz location always?</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>This app needs access to location when open.</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>Hiermee kunt u een verhaal maken</string>
    <key>NSMotionUsageDescription</key>
    <string>Motion Usage Description</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Hiermee kunt u een foto selecteren</string>
    <key>NSPhotoLibraryAddUsageDescription</key>
    <string>Hiermee kunt u een foto opslaan</string>
    <key>UIBackgroundModes</key>
    <array>
        <string>fetch</string>
        <string>location</string>
        <string>remote-notification</string>
    </array>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>FirebaseAppDelegateProxyEnabled</key>
    <string>NO</string>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <!-- TODO Replace this value: -->
                <!-- Copied from GoogleService-Info.plist key REVERSED_CLIENT_ID -->
                <string>com.googleusercontent.apps.myappid</string>
                <string>fb4856myappid</string>
            </array>
        </dict>
    </array>
    <key>FacebookAppID</key>
    <string>4856myappid</string>
    <key>FacebookDisplayName</key>
    <string>DRINKM8</string>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbapi</string>
        <string>fb-messenger-share-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
    </array>
    <key>io.flutter.embedded_views_preview</key>
    <string>YES</string>
</dict>
</plist>

CfBundledDevelopmentRegion
$(开发语言)
Cbundlexecutable
$(可执行文件名称)
CbundleIdentifier
$(产品\捆绑包\标识符)
CbundleInfo字典版本
6
CFBundleName
饮品8
CbundlePackageType
应用
CbundleShortVersionString
$(颤振\u构建\u名称)
CFBundleSignature
????
循环流化床锅炉
$(颤振/建造/编号)
LSREQUIRESPHONEOS
NSAppTransportSecurity
NSAllowsArbitraryLoads
NSCameraUsageDescription
你是谁
NSContactsUsageDescription
你的提示
N位置始终和何时使用说明
始终/使用时说明
N位置始终使用说明
我可以随时查看haz的位置吗?
NSLocationWhenUse用途说明
此应用在打开时需要访问位置。
NSM话筒用途说明
你是谁
NSMotionUsageDescription
运动使用说明
NSPhotoLibraryUsageDescription
请选择您的姓名
NSPhotoLibraryAddUsageDescription
希尔梅·昆特·乌恩·福托·奥普斯兰
UIBackgroundModes
取来
位置
远程通知
UILaunchStoryboardName
发射屏
UIMainstryBoardFile
主要
UI支持接口方向
UIInterfaceOrientationPortrait
UIInterface方向和左视图
UIInterfaceOrientationAndscapeRight
UI支持界面方向~ipad
UIInterfaceOrientationPortrait
UIInterfaceOrientation上下方向图
UIInterface方向和左视图
UIInterfaceOrientationAndscapeRight
FirebaseAppDelegateProxyEnabled
不
UIViewControllerBasedStatusBarAppearance
CbundleurlTypes
CbundleTypeRole
编辑
循环流化床锅炉方案
com.googleusercontent.apps.myappid
fb4856myappid
FacebookAppID
4856myappid
FacebookDisplayName
饮品8
LSApplicationQueriesSchemes
fbapi
fb messenger共享api
fbauth2
fbshareextension
io.flatter.embedded\u视图\u预览
对
安装FB for ios有没有遗漏一步(我只编辑了我的info.plist并将FB登录添加到pubspec yaml)


提前谢谢

我从github了解到这是软件包或sdk中的错误,或者

但对于IOS,如果您使用以下选项,它会起作用:

final fbLogin =FacebookLogin();
fbLogin.loginBehavior = FacebookLoginBehavior.webViewOnly;
final fbLogin =FacebookLogin();
fbLogin.loginBehavior = FacebookLoginBehavior.webViewOnly;