facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 908 forks source link

logInWithReadPermissions returning isCancelled value always true #646

Closed jamesawer3 closed 4 years ago

jamesawer3 commented 4 years ago

Bug Report


Environment

Click To Expand

**`react-native info` output:** ``` React Native Environment Info: System: OS: macOS 10.14.6 CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz Memory: 1.93 GB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 12.4.0 - /usr/local/bin/node npm: 6.9.2 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0 IDEs: Android Studio: 3.5 AI-191.8026.42.35.5791312 Xcode: 11.0/11A420a - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.5 => 0.59.5 npmGlobalPackages: react-native-cli: 2.0.1 ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [x] Both - **`FBSDK` module(s) you're using that has the issue:** - `logInWithReadPermissions` - **Are you using `TypeScript`?** - `N`


To Reproduce

Click To Expand

- My `react-native-fbsdk` version is 0.8.0 and my `FacebookSDK's` version is 4.40.0


Expected Behavior

Click To Expand

- I want to successfully login with facebook, I'm totally struck with this kindle help me


Code

Click To Expand

``` LoginManager.logOut(); var result = await LoginManager.logInWithReadPermissions(["public_profile", "email"]); ```


Response

Click To Expand

``` declinedPermissions: null grantedPermissions: null isCancelled: true ```

stefancrowdbotics commented 4 years ago

Same problem @HERE!

ThomasPnt commented 4 years ago

Same problem for me, but I'm on ^0.10.1 version

lysontrung1706 commented 4 years ago

I got this problem, with ios13 "react-native-fbsdk": "^0.10.1", LoginManager.logInWithPermissions => always return isCancelled:true

Dunky45 commented 4 years ago

Same here :(, this needs to be fixed as soon as possible, or people are gonna eat us alive :-D.

christos-kostopoulos commented 4 years ago

Quick workaround: Change the dependency of the react-native-fbsdk.podspec of all FBSDKCoreKit, FBSDKLoginKit, FBSDKShareKit entries to version 5.6.0

jamesawer3 commented 4 years ago

I'm using sdk and react-native-fbsdk version is 0.8.0

IrynaBt commented 4 years ago

I have the same problem for 0.10.1

Nidhi-Gandhi commented 4 years ago

I also got the same problem with 13.0 and higher It's working fine in 12.2. "react-native-fbsdk": "^0.10.1", I got this response on LoginManager.logInWithPermissions

declinedPermissions: null
grantedPermissions: null
isCancelled: true
johnlim5847 commented 4 years ago

I'm having the same issue as well. I'm on 0.10.0 and using Pod, the FBSDKCoreKit, FBSDKLoginKit, FBSDKShareKit I installed are 5.0.2

I can't even launch the popup modal(the open URL) it didn't show any error in chrome debugger nor in Xcode debugger. Can anyone help?

johnlim5847 commented 4 years ago

it was working fine on iOS 12.2 but on iOS 13 I got -canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. error when I try to call logInWithPermissions can anyone from the team help me?

Pod

  pod 'FBSDKCoreKit', '~> 5.0.2'
  pod 'FBSDKLoginKit', '~> 5.0.2'
  pod 'FBSDKShareKit', '~> 5.0.2'

Npm

react-native-fbsdk 0.10.1

UPDATE: OK finally I got it running fine on 13.0 what I did was use 5.6.0 instead of 5.0.2

lysontrung1706 commented 4 years ago

pod

it was working fine on iOS 12.2 but on iOS 13 I got -canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. error when I try to call logInWithPermissions can anyone from the team help me?

Pod

  pod 'FBSDKCoreKit', '~> 5.0.2'
  pod 'FBSDKLoginKit', '~> 5.0.2'
  pod 'FBSDKShareKit', '~> 5.0.2'

Npm

react-native-fbsdk 0.10.1

UPDATE: OK finally I got it running fine on 13.0 what I did was use 5.6.0 instead of 5.0.2

Pod pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk' pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit' pod 'FBSDKShareKit' Npm react-native-fbsdk 0.10.1 I cannot update to 5.6.0 I got this error when pod install CocoaPods could not find compatible versions for pod "FBSDKShareKit": In Podfile: FBSDKShareKit (~> 5.6.0)

how I can resolve it ???

lysontrung1706 commented 4 years ago

pod

it was working fine on iOS 12.2 but on iOS 13 I got -canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. error when I try to call logInWithPermissions can anyone from the team help me?

Pod

  pod 'FBSDKCoreKit', '~> 5.0.2'
  pod 'FBSDKLoginKit', '~> 5.0.2'
  pod 'FBSDKShareKit', '~> 5.0.2'

Npm

react-native-fbsdk 0.10.1

UPDATE: OK finally I got it running fine on 13.0 what I did was use 5.6.0 instead of 5.0.2

Pod pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk' pod 'FBSDKCoreKit' pod 'FBSDKLoginKit' pod 'FBSDKShareKit' Npm react-native-fbsdk 0.10.1 I cannot update to 5.6.0 I got this error when pod install CocoaPods could not find compatible versions for pod "FBSDKShareKit": In Podfile: FBSDKShareKit (~> 5.6.0)

how I can resolve it ???

UPDATE in my case I unlink react native fbsdk => pod install => link react native fbsdk again and I can update 5.6.0 But I got new problem "null is not an object(Evaluating 'LoginManager.logInWithPermissions')

ninjacoder-rs commented 4 years ago

remove react-native-fbsdk from pod file and add in pod pod 'FBSDKCoreKit' pod 'FBSDKLoginKit' pod 'FBSDKShareKit'

then install the pod

when pod install successfully then try to add facebook libraries manually in project Steps Add file to project goes to node_module folder>react-native-fbsdk >ios select RCTFBSDK.xcodeproj and add then link libRCTFBSDK.a to libraries

search then link libraries

florianalbrecht commented 4 years ago

If you have problems updating to version 5.6.0 via Cocoapods just do "pod repo update" and "pod update FBSDKCoreKit FBSDKLoginKit FBSDKShareKit" afterwards.

fostahgix commented 4 years ago

I was able to get this working combining the two comments above (@florianalbrecht and @lysontrung1706 )running the following:

pod repo update

In your pod file

Pod

  pod 'FBSDKCoreKit', '~> 5.6.0'
  pod 'FBSDKLoginKit', '~> 5.6.0'
  pod 'FBSDKShareKit', '~> 5.6.0'

In your package.json "react-native-fbsdk": "0.10.1"

Then run rm -rf node_modules && yarn && cd ios && pod install

Nidhi-Gandhi commented 4 years ago

I was using react-native-fbsdk Without Cocoapods. So now I add these code to Podfile:

  pod 'FBSDKCoreKit'
  pod 'FBSDKLoginKit'
  pod 'FBSDKShareKit'

  # pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'

Then run pod install When I tried to run this project then got error of duplicate references. remove FBSDKCoreKit.framework, FBSDKLoginKit.framework, FBSDKShareKit.framework from "Frameworks" folder from the project directory(ProjectName=>Frameworks) and it's works perfect.

stefancrowdbotics commented 4 years ago

I fixed this issue when return to old version of xCode. My current version is 10.3.0. Version with error is 11.x.x

ammichael commented 4 years ago

Worked for me, but this is probably a temporary solution.

Project package.json:

    "react-native-fbsdk": "https://github.com/facebook/react-native-fbsdk.git#0.10.0-stable",

Podfile:

  pod 'FBSDKCoreKit', '~> 5.6.0'
  pod 'FBSDKLoginKit', '~> 5.6.0'
  pod 'FBSDKShareKit', '~> 5.6.0'
vforvasile commented 4 years ago

I'm not using Pods, my solution was to download FBSDK (5.6.0) that supports iOS 13 (from here) and replace the old frameworks.

The above solution will work if you manually link react-native-fbsdk

I am using "react-native-fbsdk": "^0.10.0" "react-native": "0.59.9"

p.s. using pods: '~> 5.6.0' I managed to build it but encountered an error when clicking log in, same as here

moulie415 commented 4 years ago

@ammichael your solution worked for me but I had to run

pod install --repo-update

instead

karltaylor commented 4 years ago

I'm not using Pods, my solution was to download FBSDK (5.6.0) that supports iOS 13 (from here) and replace the old frameworks.

The above solution will work if you manually link react-native-fbsdk

I am using "react-native-fbsdk": "^0.10.0" "react-native": "0.59.9"

p.s. using pods: '~> 5.6.0' I managed to build it but encountered an error when clicking log in, same as here

So it is still not working for you on 0.59.9?

chilidoggca commented 4 years ago

react-native 0.59.10 react-native-fbsdk 0.10.1

I finally got this working in iOS 13 by manually linking react-native-fbsdk (follow instructions here): https://facebook.github.io/react-native/docs/linking-libraries-ios#manual-linking

Podfile

pod 'FBSDKCoreKit', '~> 5.6.0'
pod 'FBSDKLoginKit', '~> 5.6.0'
pod 'FBSDKShareKit', '~> 5.6.0'
motogod commented 4 years ago

I was using react-native-fbsdk Without Cocoapods, and had the same issue,

Take others solutions, I think I should upgrade my react-native-fbsdk first.

"react-native": "0.57.1"
"react-native-fbsdk": "0.8.0"

When I try to upgrade it by type command yarn upgrade react-native-fbsdk@0.10.1

Run the project shows the error: /Users/motogod19/MyWork/SalonYarn/polipoli-mobile-salon/node_modules/react-native-fbsdk/ios/RCTFBSDK/login/RCTFBSDKLoginManager.m:78:3: Unknown type name 'FBSDKLoginManagerLoginResultBlock'; did you mean 'FBSDKLoginManagerLoginResult'?

螢幕快照 2019-10-18 下午3 58 01

Any one has the same problem like me ?

How to solve it ?

jamesawer3 commented 4 years ago

Updated my React native version updated fbsdk version and it started working like a charm

wellmonge commented 4 years ago

same here! rn-0.59.9 and fbsdk-0.10.1 --> trying to update to rn-0.60.9 and fbsdk-1.0.4...

motogod commented 4 years ago

I was using react-native-fbsdk Without Cocoapods, and had the same issue,

Take others solutions, I think I should upgrade my react-native-fbsdk first.

"react-native": "0.57.1"
"react-native-fbsdk": "0.8.0"

When I try to upgrade it by type command yarn upgrade react-native-fbsdk@0.10.1

Run the project shows the error: /Users/motogod19/MyWork/SalonYarn/polipoli-mobile-salon/node_modules/react-native-fbsdk/ios/RCTFBSDK/login/RCTFBSDKLoginManager.m:78:3: Unknown type name 'FBSDKLoginManagerLoginResultBlock'; did you mean 'FBSDKLoginManagerLoginResult'?

螢幕快照 2019-10-18 下午3 58 01

Any one has the same problem like me ?

How to solve it ?

Fix my issue now.

I can't fix my issue by replacing SDK version. So I try to use cocopods.

Step 1: pod init Step 2: Rember uncomment platform :ios, '9.0' on pod file before you type pod install(I install 5.8.0) Step 3: Delete your older Facebook SDK that is under project Framework folder and remove these framework under Link Binary With Libraries. (Otherwise you will see duplicate symbols error)

then Build will success.

chr4ss1 commented 4 years ago

solution by @vforvasile works. I will just say that LoginManager.logInWithReadPermissions is deprecated in react-native-fbsdk 0.10.1, so instead now you useLoginManager.logInWithPermissions

https://github.com/facebook/react-native-fbsdk/issues/566

chungheepark commented 4 years ago

I solved!

My iOS project is a legacy system based on objective-c with no pods. And I tried to use cocoapods, But I couldn't use cocoapods because of legacy search path settings.

  1. Target-> BuildSettings
  2. ${inherited} syntax has been added to the Framework, Library, Header search path.
  3. Sort ${inherited} syntax to the top.

And add below line to Podfile:

pod 'FBSDKCoreKit', '~> 5.6.0'
pod 'FBSDKLoginKit', '~> 5.6.0'
pod 'FBSDKShareKit', '~> 5.6.0'

Then you will be success to build!

ghost commented 4 years ago

I solved the issue !!! Add following lines strings.xml <string name="facebook_app_id">/*your app id*/</string>

AndroidManifest.xml <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

Mcebrera commented 4 years ago

Upgrading my react-native-fbsdk from 0.8.0 to 0.10.0 fixed this issue for me.

For those who are having errors on Xcode when upgrading from 0.8.0 to 0.10.0

I was having our FB button always return a isCancelled = true value when pressed. Essentially, it wasn't letting people in via FB button.

I found this comment and followed the instructions and it built successfully on Xcode

make sure you delete the bolt.framework file. I did every step up to that and it wasn't building but once I deleted it, it built successfully.

Also, you'll wanna check the breaking changes in the new version you're upgrading to so that you replace anything that was removed.

MelihOzyurt commented 4 years ago

I solved!

  • My env: xcode: 11.1 react: 16.8.3 react-native: 0.59.9 react-native-fbsdk: 0.10.1 objectivec: yes pods: no

My iOS project is a legacy system based on objective-c with no pods. And I tried to use cocoapods, But I couldn't use cocoapods because of legacy search path settings.

  1. Target-> BuildSettings
  2. ${inherited} syntax has been added to the Framework, Library, Header search path.
  3. Sort ${inherited} syntax to the top.

And add below line to Podfile:

pod 'FBSDKCoreKit', '~> 5.6.0'
pod 'FBSDKLoginKit', '~> 5.6.0'
pod 'FBSDKShareKit', '~> 5.6.0'

Then you will be success to build!

I solved with your solution but i got this warning.

Duplicate symbols for architecture x8664 under Xcode warning.

The problem was solved when i followed the steps below.

Build Phases in Link Binary With Libraries,

  1. remove login/share/core.framework,
  2. add login/share/core.a files.

Thank you.

ahsanmster commented 3 years ago

remove react-native-fbsdk from pod file and add in pod pod 'FBSDKCoreKit' pod 'FBSDKLoginKit' pod 'FBSDKShareKit'

then install the pod

when pod install successfully then try to add facebook libraries manually in project Steps Add file to project goes to node_module folder>react-native-fbsdk >ios select RCTFBSDK.xcodeproj and add then link libRCTFBSDK.a to libraries

search then link libraries

after above steps i face following issue

image

olgaababic commented 3 years ago

Did anyone have problem with Android? I get always isCancelled with Android devices. And it happens when I ask for email as permission.