Skip to content

Commit

Permalink
docs(example): update Swift compile fix, package.json example targets
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehardy committed Jul 6, 2021
1 parent 1ec6d85 commit 7a55d56
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,33 @@ Undefined symbols for architecture x86_64:
(maybe you meant: _swift_FORCE_LOAD$swiftWebKit$_FBSDKLoginKit, _swift_FORCE_LOAD$swiftWebKit$_FBSDKShareKit , _swift_FORCE_LOAD$swiftWebKit$_FBSDKCoreKit )
ld: symbol(s) not found for architecture x86_64
```

After **facebook-ios-sdk v7** you need to create a swift file like so ([File.Swift](https://github.com/thebergamo/react-native-fbsdk-next/blob/master/example/ios/RNFBSDKExample/File.swift)) in the main project folder. When you add an empty swift file, XCode will ask you if you want to "Create Bridging Header".

It will include to the Header Search Path on your build settings:
After **facebook-ios-sdk v7** (written with Swift parts) you need to coordinate Swift language usage with Objective-C for iOS.

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"
The empty swift file makes this change to the Header Search Path on your build settings:
```
$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)
$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
```

- or add this stanza in the postinstall section of your Podfile as a possible workaround (then `pod deintegrate && pod install`):

```ruby
# Mixing Swift and Objective-C in a react-native project may be problematic.
# Workaround: https://github.com/facebookarchive/react-native-fbsdk/issues/755#issuecomment-787488994
installer.aggregate_targets.first.user_project.native_targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(inherited)', '$(SDKROOT)/usr/lib/swift']
end
end
```

Both result in fixing search paths.


## Usage

### SDK Initialization
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
"flow": "flow",
"lint": "eslint ./src",
"test": "yarn validate:prettier && yarn validate:eslint && yarn validate:flow",
"validate:eslint": "eslint \"src/**/*\" \"example/src/**/*\"",
"validate:eslint": "eslint \"src/**/*\"",
"validate:flow": "flow",
"validate:prettier": "prettier \"src/**/*.js\" \"example/src/**/*.js\" --check",
"example:ios": "cd ./example && react-native run-ios",
"example:android": "cd ./example && react-native run-android --no-jetifier",
"validate:prettier": "prettier \"src/**/*.js\" --check",
"example:ios": "cd ./RNFBSDKExample && yarn ios",
"example:android": "cd ./RNFBSDKExample && yarn android --no-jetifier",
"semantic-release": "semantic-release"
},
"files": [
Expand Down

0 comments on commit 7a55d56

Please sign in to comment.