Deprecated
AppEventsLogger.deactivateApp()
andAppEventsLogger.onContextStop
are deprecated.
To useAppEventsLogger
, add a call toAppEventsLogger.activateApp()
from theonCreate
method in yourApplication
class. Note that you need to create the class yourself.
YouronCreate
method in theApplication
class should look like this:
import com.facebook.appevents.AppEventsLogger;
import com.facebook.FacebookSdk;
public class MyApplication extends Application {
// Updated your class body:
@Override
public void onCreate() {
super.onCreate();
// Initialize the SDK before executing any other operations.
FacebookSdk.sdkInitialize(getApplicationContext());
// Use AppEventsLogger to log custom events.
AppEventsLogger.activateApp(this);
}
}
Breaking Changes
- Merge separate iOS projects into one single project.
- Drop support for Cocoapods. Adapt to rnpm for native side setup.
Upgrade to 0.2.0
If you're already using 0.1.0, here're the steps to upgrade to 0.2.0.
Android (Using Facebook Android SDK 4.11.+)
- You can safely remove the
onCreate()
,onResume
,onPause
, andonStop
fromMainActivity.java
. - Add a call to
FacebookSdk.sdkInitialize
fromonCreate()
in your Application class as described in _Deprecated_ section.
iOS (If you're happy with not using Cocoapods)
- Run the following command to clean up the pods from the project.
$ sudo gem install cocoapods-deintegrate cocoapods-clean
$ pod deintegrate
$ pod clean
$ rm Podfile
- Reinstall react-native dependency into the app project.
// Reinstall the node_modules by `npm install --save react-native` first if the following command fail
$ react-native upgrade // Only choose to overwrite the xcodeproj file to get the static libraries.
- Reinstall react-native-fbsdk 0.2.0.
// In package.json, change the 'react-native-fbsdk' version to be "^0.2.0"
$ rnpm install react-native-fbsdk
Include Facebook iOS SDK inside your project
Here're the set up instructions to keep the Facebook iOS SDK inside your project:
- Create a FacebookSDK directory under node_modules/react-native-fbsdk/iOS/. We'll put the SDK here.
- Download and unzip FacebookSDK archive, copy FBSDKCoreKit.framework, FBSDKLoginKit.framework and FBSDKShareKit.framework and paste it into node_modules/react-native-fbsdk/iOS/FacebookSDK.
- Create a new group Frameworks in the Project navigator and drag the FBSDKCoreKit.framework, FBSDKLoginKit.framework and FBSDKShareKit.framework into the Frameworks group.
- Tell the RCTFBSDK target where to search for the SDK by adding
$(SRCROOT)/FacebookSDK
in the Frameworks Search Path section under the target RCTFBSDK's Build Settings. - Tell your project where to search for the SDK by adding
$(SRCROOT)/../node_modules/react-native-fbsdk/iOS/FacebookSDK
in the Frameworks Search Path section under the app target Build Settings. - Follow the Getting Started Guide to Create a Facebook App, Configure Facebook App Settings for iOS, Configure Xcode Project, Connect Application Delegate. Now you can start using the SDK.
Bug fixes
- Fix import statement to be compatible with react-native 0.25.1+.
- Fix Flow error so that
LoginButton
props can be optional. - Fix Flow error of
LoginButton
proponLoginFinished
. - Fix
ShareOpenGraphContent
builder in iOS. - Fix missing
ShareContent
inMessageDialog.canShow()
. - Fix
LoginButton
callback gets called multiple times - Fix custom app events doesn't show up in App Analytic Dashboard.