Open Tawfeekamr opened 7 years ago
The 'react-native-facebook-login' worked for me by do this steps:
0- Create New react-native project then install npm by npm i
1- Download the SDK and unzip the archive to ~/Documents/FacebookSDK
the name of folder must to be FacebookSDK and this folder in Documents.
2- Make new folder named Framework From Documents/FacebookSDK folder, drag the folder Bolts.framework, FBSDKCoreKit.Framework, FBSDKLoginKit.Framework, FBSDKShareKit.Framework into your Xcode Projects Framework folder.
3- Goto https://developers.facebook.com/ Make new App from Facebook Dev. then input Bundle Identifier to get App ID ... skip this steps: Configure your info.plist Track App Installs and App Opens Enable Sign in then copy the AppID.
4- Go to react-native terminal and install react-native-fbsdk by
npm install react-native-fbsdk@0.6.0 --save
react-native link react-native-fbsdk
5- Go to your react-native app then open iOS folder, the direction now is YourApp/ios
make new file without extintion name Podfile open this file by textedit and put this code (don't forget to change YourApp to real name of your app):
# You Podfile should look similar to this file. React Native currently does not support use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target '<YourApp>' do
# Fixes required for pod specs to work with rn 0.42
react_native_path = "../node_modules/react-native"
pod "Yoga", :path => "#{react_native_path}/ReactCommon/yoga"
pod "React", :path => react_native_path, :subspecs => [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket'
]
pod 'GoogleMaps' # <~~ remove this line if you do not want to support GoogleMaps on iOS
# when not using frameworks we can do this instead of including the source files in our project (1/4):
# pod 'react-native-maps', path: '../../'
# pod 'react-native-google-maps', path: '../../' # <~~ if you need GoogleMaps support on iOS
end
6- Change terminal dir to YourApp/ios
then apply this:
npm install pod
7- Now to to Xcode project that found react-native folder , then go to AppDelegate.m and put this code replace all the file by the code above.
8- Back to YourApp dir in terminal , then Apply this command in terminal npm install plist xcode adm-zip --save-dev
9- Then apply this cp ./node_modules/react-native-fbsdk/ios_setup.js ./ios_setup.js
in terminal.
10- Next: node ./ios_setup.js [App ID] [App Name]
, by change App ID to facebook id you get it , App name the same name you created in past (ex. YourApp).
11 - You must sure the Xcode like this:
be sure there is no bugs related to import xxxxxx.h !! this issues will build sometimes correctly but the app not working and FBSDK will show errors, step 5-6 to resolve problem called
#import <React/RCTBundleURLProvider.h>
not found.
12- You must but ~/Documents/FacebookSDK
to Build Settings under search path like you see in this photo.
13- Now open index.ios.js download it with worked code 100%: http://www.mediafire.com/file/tajh1izyx4j6b3v/index.ios.js
or follow this tips to write another code https://developers.facebook.com/docs/react-native/login
14- After replace your index.ios.js with downloaded in (13), open it and change this:
export default class ZApp extends Component
to your real app name
export default class YourApp extends Component
Then save it!
15- Back to terminal Now Build App by react-native run-iso
, the app must work 💯 %.
Best Regards
Tawfeeq Amro
FBSDK Please Work
1 week from troubleshooting! same issue!! i just working on login with Facebook using react-native , i create more than 12 projects with different codes and methods i see it in internet no one love my problem.
In first project (i create it in past) the problem was same issue when i import FBSDK:
`import FBSDK, {LoginManager} from 'react-native-fbsdk'
[What i try]
reset cache , reset npm , delete modules , change require , install last version of react-native , install alpha6 , alpha 12 , restart mac , Xcode , quit simulation , npm start --reset-cache , rm -rf node_modules && npm install , watchman watch-del-all , kill process and restart npm , install non 8 , install npm 6 LTS
@ i follow this tutorials :
https://www.youtube.com/watch?v=rAXVKapP5cM https://www.youtube.com/watch?v=rAXVKapP5cM https://www.youtube.com/watch?v=aRJY7Hbe9jI https://www.youtube.com/watch?v=yQi6F4Dh6gY
In Last project i make it very carefully by download example project named "react-native-fbsdk-master" from github by dzhuowen ,
If you have project worked for you please upload the file or share code to see what is the problem.
@My Hardware spec: