React-native-fbsdk: logInWithReadPermissions returning isCancelled value always true

Created on 26 Sep 2019  路  33Comments  路  Source: facebook/react-native-fbsdk

Bug Report

  • I'm using react native fbsdk and trying to login but I'm getting isCancelled value as true always

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

Most helpful comment

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

All 33 comments

Same problem @HERE!

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

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

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

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

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

I have the same problem for 0.10.1

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

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?

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

  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

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

  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 ???

pod

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

  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')

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

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

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 '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

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.

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

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'

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

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

pod install --repo-update

instead

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?

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'

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 [email protected]

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 ?

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

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

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 [email protected]

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.

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

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 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"/>

_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.

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 x86_64 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.

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akash-rajput picture akash-rajput  路  4Comments

peymancyb picture peymancyb  路  6Comments

andfs picture andfs  路  5Comments

yanguyt picture yanguyt  路  4Comments

sibelius picture sibelius  路  4Comments