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

iOS Get Started page no longer has instructions for Objective-C #762

Open qispark opened 4 years ago

qispark commented 4 years ago

React Native projects for iOS are still based on Objective-C, however the link to the Get Started guide in README.md, section 3.2 ("Follow steps 3 and 4 in the Getting Started Guide for Facebook SDK for iOS.") no longer contain Objective-C instructions.

FWIW, the most recent archive of the Getting Started Guide still contains instructions for Obj-C. April 14 archive of Getting Started

I was able to use those instructions but I had to replace ApplicationDelegate with FBSDKApplicationDelegate. Perhaps these instructions should be included inside README.md.

Dev-Ditrict-Web commented 4 years ago

I have the same issue.

Yes It would be nice to have a clear instructions on how to do that.

neiker commented 4 years ago

I come here looking for this. Thanks for the link to the archive

neiker commented 4 years ago

Also notice you should use FBSDKApplicationDelegate instead of ApplicationDelegate. But xcode will tell you about this when you try to build the app

Dev-Ditrict-Web commented 4 years ago

@neiker In what file do you change this : use FBSDKApplicationDelegate instead of ApplicationDelegate ?

neiker commented 4 years ago

@Dev-Ditrict-Web on AppDelegate.m

ravindranpandu commented 4 years ago

Hey Everyone,

I was look for the same objective-c instructions and managed to integrate the fbsdk finally, i am posting it below for people who are still having trouble finding/implementing it.

Include the FBSDKCoreKit at the top of the AppDelegate.m file

#import "AppDelegate.h"
// add this next line
#import <FBSDKCoreKit/FBSDKCoreKit.h>

then under your @implementation AppDelegate add these snippets at the last line before your @end

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
  BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
    openURL:url
    sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
    annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
  ];
  // Add any custom logic here.
  return handled;
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
  BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
    openURL:url
    sourceApplication:sourceApplication
    annotation:annotation
  ];
  // Add any custom logic here.
  return handled;
}

I hope this will help someone who is finding a way to integrate fbsdk, cheers happy coding.

hakkikonu commented 4 years ago

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation

gives Implementing deprecated method warning