Skip to content

Commit

Permalink
feat(ios)!: upgrade facebook-ios-sdk to v12 (#132)
Browse files Browse the repository at this point in the history
* chore: upgrade FBSDK to v12.1.0
* chore: cleanup build warnings/deprecations
* fix: issue with script variable quoting
* chore(README): update instructions to setup example folder
* chore: update example folder artifacts based on FBSDK v12 upgrade

BREAKING CHANGE: iOS minimum 10.0, getAdvertiserID always null on iOS, setAdvertiserTrackingEnabled always returns true on iOS
  • Loading branch information
CodeToTee authored Nov 13, 2021
1 parent 595d2ca commit d813153
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 138 deletions.
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To use this library you need to ensure you match up with the correct version of
| <= 8.0.1 | `react-native-fbsdk` `<= 0.10` | `<= 0.59.x` |

> ⚠️ * Attention
>
>
> Please notice that this module in versions after 4.2.0 only supports React Native versions above 0.63.3 as it's the oldest version of React Native which support latest XCode version. Technically, it may work on older versions (test it to be sure) but **they are not supported**. Changes that accidentally break older react-native versions may be issued without regard to semantic versioning constraints because we do not test against the older versions. Please see [this issue](https://github.com/thebergamo/react-native-fbsdk-next/issues/30) for an example of a previous break. Please update to current react-native versions.
### 1. Install the library
Expand Down Expand Up @@ -59,7 +59,7 @@ $ cd ios/ && pod install

- **React Native <= 0.59**

> For support with React Native <= 0.59, please refer to [React Native FBSDK](https://github.com/facebook/react-native-fbsdk)
> For support with React Native <= 0.59, please refer to [React Native FBSDK](https://github.com/facebook/react-native-fbsdk)
If you can't or don't want to use the CLI tool, you can also manually link the library using the instructions below (click on the arrow to show them):

Expand Down Expand Up @@ -188,7 +188,7 @@ Undefined symbols for architecture x86_64:

Either:

- add a new file named `File.Swift` in the main project folder and answer "yes" when Xcode asks you if you want to "Create Bridging Header"
- add a new file named `File.Swift` in the main project folder and answer "yes" when Xcode asks you if you want to "Create Bridging Header"
The empty swift file makes this change to the Header Search Path on your build settings:
```
$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)
Expand All @@ -208,14 +208,14 @@ $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
```

Both result in fixing search paths.

5. AppLink.fetchDeferredAppLink does not work (on iOS at least)

Both the Facebook App and your app have to have App Tracking Transparency (ATT) permission granted for facebook deferred app links to work. See [this related issue](https://github.com/thebergamo/react-native-fbsdk-next/issues/104#issuecomment-931488609)

6. You get an exception `App ID not found. Add a string value with your app ID for the key FacebookAppID to the Info.plist or call [FBSDKSettings setAppID:].`

If you find yourself in this situation, and you are certain that you have the FacebookAppID in your Info.plist or that you have called `setAppId`, you *may* be able to fix it by adding the following lines to `AppDelegate.m` inside the `- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions`, just before the `return YES` statement:
If you find yourself in this situation, and you are certain that you have the FacebookAppID in your Info.plist or that you have called `setAppId`, you *may* be able to fix it by adding the following lines to `AppDelegate.m` inside the `- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions`, just before the `return YES` statement:

```
[[FBSDKApplicationDelegate sharedInstance] application:application
Expand Down Expand Up @@ -631,15 +631,23 @@ new GraphRequestManager().addRequest(infoRequest).start();
```
## Example app
To run the example app, you'll first need to setup the environment:
```
refresh-example.sh
```
This will create a new app in the `RNFBSDKExample` directory, using the latest version of React Native.
Next, it will patch the necessary files so you may run the example app.
### iOS
- Run `pod install` in `example/ios`
- Run `yarn example:ios`
```
yarn example:ios
```
or
```
yarn example:android
```
### Android
Note: You'll probably want to change the Facebook App ID to your own, else the example app won't be able to login. To change it, edit your local copy of `refresh-example.sh`, update the `FacebookAppId` variable, then re-run `refresh-example.sh` to regenerate the example directory.
- Run `yarn example:android`
## Join the React Native community
Expand Down
50 changes: 19 additions & 31 deletions RNFBSDKExample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ PODS:
- boost (1.76.0)
- CocoaAsyncSocket (7.6.5)
- DoubleConversion (1.1.6)
- FBAEMKit (11.2.1):
- FBAEMKit/AEM (= 11.2.1)
- FBAEMKit/AEM (11.2.1):
- FBSDKCoreKit_Basics (~> 11.2.1)
- FBAEMKit (12.1.0):
- FBSDKCoreKit_Basics (= 12.1.0)
- FBLazyVector (0.66.3)
- FBReactNativeSpec (0.66.3):
- RCT-Folly (= 2021.06.28.00-v2)
Expand All @@ -14,24 +12,14 @@ PODS:
- React-Core (= 0.66.3)
- React-jsi (= 0.66.3)
- ReactCommon/turbomodule/core (= 0.66.3)
- FBSDKCoreKit (11.2.1):
- FBSDKCoreKit/Core (= 11.2.1)
- FBSDKCoreKit/Core (11.2.1):
- FBAEMKit (~> 11.2.1)
- FBSDKCoreKit_Basics (~> 11.2.1)
- FBSDKCoreKit_Basics (11.2.1):
- FBSDKCoreKit_Basics/Basics (= 11.2.1)
- FBSDKCoreKit_Basics/Basics (11.2.1)
- FBSDKLoginKit (11.2.1):
- FBSDKLoginKit/Login (= 11.2.1)
- FBSDKLoginKit/Login (11.2.1):
- FBSDKCoreKit (~> 11.2.1)
- FBSDKCoreKit_Basics (~> 11.2.1)
- FBSDKShareKit (11.2.1):
- FBSDKShareKit/Share (= 11.2.1)
- FBSDKShareKit/Share (11.2.1):
- FBSDKCoreKit (~> 11.2.1)
- FBSDKCoreKit_Basics (~> 11.2.1)
- FBSDKCoreKit (12.1.0):
- FBAEMKit (= 12.1.0)
- FBSDKCoreKit_Basics (= 12.1.0)
- FBSDKCoreKit_Basics (12.1.0)
- FBSDKLoginKit (12.1.0):
- FBSDKCoreKit (= 12.1.0)
- FBSDKShareKit (12.1.0):
- FBSDKCoreKit (= 12.1.0)
- Flipper (0.99.0):
- Flipper-Folly (~> 2.6)
- Flipper-RSocket (~> 1.4)
Expand Down Expand Up @@ -300,13 +288,13 @@ PODS:
- react-native-fbsdk-next/Login (= 4.6.0)
- react-native-fbsdk-next/Share (= 4.6.0)
- react-native-fbsdk-next/Core (4.6.0):
- FBSDKCoreKit (~> 11.2.1)
- FBSDKCoreKit (~> 12.1.0)
- React-Core
- react-native-fbsdk-next/Login (4.6.0):
- FBSDKLoginKit (~> 11.2.1)
- FBSDKLoginKit (~> 12.1.0)
- React-Core
- react-native-fbsdk-next/Share (4.6.0):
- FBSDKShareKit (~> 11.2.1)
- FBSDKShareKit (~> 12.1.0)
- React-Core
- React-perflogger (0.66.3)
- React-RCTActionSheet (0.66.3):
Expand Down Expand Up @@ -523,13 +511,13 @@ SPEC CHECKSUMS:
boost: a7c83b31436843459a1961bfd74b96033dc77234
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
FBAEMKit: 5de0a7aaa854eec69bb5be20795952a63d38a5f6
FBAEMKit: 56c0bb9b42e3747cd82b67934f0c2b19325382ea
FBLazyVector: de148e8310b8b878db304ceea2fec13f2c02e3a0
FBReactNativeSpec: 6192956c9e346013d5f1809ba049af720b11c6a4
FBSDKCoreKit: bf655f808b040ed66a72b9922911b39d703e64f4
FBSDKCoreKit_Basics: 73ebe3a27eb688ac5b5aa7e99f68992993042115
FBSDKLoginKit: 2e76831ef08d356b8f9150ea51cce865074ea304
FBSDKShareKit: 1c8c3000880382ae005fe4a4e7eae9932db1a837
FBSDKCoreKit: 75368765d9c2303073145a7925dfaa9d60bcd77b
FBSDKCoreKit_Basics: 39865aff97e5f6951a78fb3e89dc4460e35e1895
FBSDKLoginKit: e993f97c7cc794c5da4056d8aec3c3d66033a727
FBSDKShareKit: 24943f539dbe382a6fad04952ea1aee29b100c1f
Flipper: 30e8eeeed6abdc98edaf32af0cda2f198be4b733
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
Flipper-DoubleConversion: 57ffbe81ef95306cc9e69c4aa3aeeeeb58a6a28c
Expand All @@ -555,7 +543,7 @@ SPEC CHECKSUMS:
React-jsiexecutor: 433a691aee158533a6a6ee9c86cb4a1684fa2853
React-jsinspector: d9c8eb0b53f0da206fed56612b289fec84991157
React-logger: e522e76fa3e9ec3e7d7115b49485cc065cf4ae06
react-native-fbsdk-next: b1572d5e2b9f6d9d362e0ed3fbb444a714db405b
react-native-fbsdk-next: 81dc96abbc75057c70dfd0880de5f50b432719f4
React-perflogger: 73732888d37d4f5065198727b167846743232882
React-RCTActionSheet: 96c6d774fa89b1f7c59fc460adc3245ba2d7fd79
React-RCTAnimation: 8940cfd3a8640bd6f6372150dbdb83a79bcbae6c
Expand Down
Loading

0 comments on commit d813153

Please sign in to comment.