Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Build Failing on latest Xcode #32

Merged
merged 3 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,45 @@ For more details, go to [React Native Environment Setup](https://reactnative.dev
- Rename folders `Boilerplate....` according to your project name.
- Delete the `project.pbxproj` file in the `Boilerplate.xcodeproj` folder.
- Delete the `Boilerplate.xcscheme` file in the `Boilerplate.xcodeproj/xcshareddata/xcschemes` folder.
- Update `FileRef location` in `Boilerplate.xcwor
- Update `FileRef location` in `Boilerplate.xcworkspace/contents.xcworkspacedata`
- Update `self.moduleName` in `Boilerplate/AppDelegate.mm`
- Update `CFBundleDisplayName` in `Boilerplate/Info.plist`
- Update `label` in `Boilerplate/LaunchScreen.storyboard`
- Update `interface` and `implementation` in `BoilerplateTests/BoilerplateTests.m`
- Update `target` in `Podfile` (main and Tests)
- Delete `Podfile.lock` file
- Install `pod`.
- run `pod install` command (in `ios/` folder)

# Running the project

Assuming you have all requirements installed, you can run the project by running:

- `yarn start` to start the metro bundler, in a dedicated terminal window
- `yarn ios` or `yarn android` to run the application on any of these platform

# Using Localhost Backend Endpoint on Android

To use the localhost backend endpoint on Android, you need to follow one of these steps:

- Expose your local backend using ngrok or any other similar software.
- Use `adb reverse tcp` to forward the port from your machine to the Android device:
```
adb -s <emulator_device_id> reverse tcp:<localhost_port> tcp:<localhost_port>
```

Then, update the `API_BASE_URL` in your `.env` file accordingly.

## Troubleshooting guides

- In MacBook, you'll get a warning prompt similar to this - `XXXXX Can't be opened because it is unidentified developer`, when you try to launch android emulator.
To fix this, follow these steps:
```
Click on Cancel on the message,
Now go to Apple Menu: System Preferences... / System Settings...
Click on Privacy & Security
Here you should see "Allow apps downloaded from: "Android Emulator" was blocked from use because it is not from an identified developer."
Click on open Anyways
You will again see a warning prompt saying "Running "Android Emulator" will harm your computer"
Click on open
```
16 changes: 16 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ target 'Boilerplate' do
end

post_install do |installer|

# This is a workaround for an issue causing iOS builds to fail due to missing include in Flipper.
# For more details, see: https://github.com/facebook/react-native/issues/43335#issuecomment-1980788427
installer.pods_project.targets.each do |target|
if target.name == 'Flipper'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @abhishek310001 - Verified locally and this fix works. But it'd be good to add a comment here on what issue we are trying to fix, and possibly add the link from where this fix was obtained (a link to GH/stackoverflow maybe)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for verifying, will add a comment ASAP.

file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
contents = File.read(file_path)
unless contents.include?('#include <functional>')
File.open(file_path, 'w') do |file|
file.puts('#include <functional>')
file.puts(contents)
end
end
end
end

# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,6 @@ SPEC CHECKSUMS:
Yoga: 65286bb6a07edce5e4fe8c90774da977ae8fc009
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 641830ab5952518edb456584ae7206225e7538d2
PODFILE CHECKSUM: 1cd0f385bbc3fd8b0530c0264700ebff8d74e2c3

COCOAPODS: 1.15.2
Loading