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

Use build_type to handle non use_frameworks #1262

Merged
merged 1 commit into from
Mar 5, 2021
Merged

Conversation

mfazekas
Copy link
Contributor

@mfazekas mfazekas commented Mar 3, 2021

Fixes: #1097

This needs to be added to the Podfile:

pre_install do |installer|
   $RNMBGL.pre_install(installer)
   ...
end
post_install do |installer|
   $RNMBGL.post_install(installer)
   ....
end

@mfazekas mfazekas requested a review from ferdicus March 4, 2021 16:21
@mfazekas mfazekas merged commit ac9ab84 into master Mar 5, 2021
@ferdicus
Copy link
Member

ferdicus commented Mar 5, 2021

hey @mfazekas , does this maybe warrant a new release too?

Edit: How were you able to built /example?
I'm getting this error when trying:

example/ios/Pods/Headers/Public/libevent/event.h:44:10: fatal error: 'event2/event-config.h' file not found
#include <event2/event-config.h>

Which seems to be linked to Flipper

putting this in the Podfile fixes the issue:
45: use_flipper!({ 'Flipper' => '0.76.0' })

Or we just comment the flipper part out and leave it to users to uncomment if they want to use it (and know what they're doing)

@mfazekas
Copy link
Contributor Author

mfazekas commented Mar 5, 2021

hey @mfazekas , does this maybe warrant a new release too?

Edit: How were you able to built /example?
I'm getting this error when trying:

example/ios/Pods/Headers/Public/libevent/event.h:44:10: fatal error: 'event2/event-config.h' file not found
#include <event2/event-config.h>

Which seems to be linked to Flipper

putting this in the Podfile fixes the issue:
45: use_flipper!({ 'Flipper' => '0.76.0' })

Or we just comment the flipper part out and leave it to users to uncomment if they want to use it (and know what they're doing)

This facebook/react-native#30836 recommends this workaround:

use_flipper!({ 'Flipper-Folly' => '2.3.0' })

@ferdicus
Copy link
Member

ferdicus commented Mar 5, 2021

hey @mfazekas , does this maybe warrant a new release too?
Edit: How were you able to built /example?
I'm getting this error when trying:

example/ios/Pods/Headers/Public/libevent/event.h:44:10: fatal error: 'event2/event-config.h' file not found
#include <event2/event-config.h>

Which seems to be linked to Flipper
putting this in the Podfile fixes the issue:
45: use_flipper!({ 'Flipper' => '0.76.0' })
Or we just comment the flipper part out and leave it to users to uncomment if they want to use it (and know what they're doing)

This facebook/react-native#30836 recommends this workaround:

use_flipper!({ 'Flipper-Folly' => '2.3.0' })

Yeah, one of the two will do the trick. ✅

After I got that working, I actually tried to disable Flipper all together (looking into adding an iOS build action).
However, when I try the recommended "comment out flipper stuff in the Podfile" I get an error message AppDelegate.m: 'FlipperKit/FlipperClient.h' file not found.

I guess it still tries to import those files, although Flipper is disabled...
Setting FB_SONARKIT_ENABLED to 0 in example/ios/RNMapboxGLExample.xcodeproj/project.pbxproj also doesn't seem to help here 😕

Any clues?
Cheers 🍻 have a good weekend

@ghadeeraqraa1992
Copy link

I'm getting the below error :

[!] An error occurred while processing the pre-install hook of the Podfile.

undefined method `pre_install' for nil:NilClass

@ansarikhurshid786
Copy link
Contributor

ansarikhurshid786 commented Mar 7, 2021

@mfazekas
I have update added in pod:

pre_install do |installer|
    $RNMBGL.pre_install(installer)
  end

  post_install do |installer|
    $RNMBGL.post_install(installer)
  end

commenting in pod
# pod "react-native-mapbox-gl", :path => "../node_modules/@react-native-mapbox-gl/maps"

Do i need to update following in my project:
example/ios/RNMapboxGLExample.xcodeproj/project.pbxproj
react-native-mapbox-gl.podspec

because i am getting following error:

[!] An error occurred while processing the pre-install hook of the Podfile.
undefined method `pre_install' for nil:NilClass
/Users/mac1/Users/Khurshid/Projects/OnwaniClick/Source/OnwaniClick/ios/Podfile:26:in `block (3 levels) in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:162:in `pre_install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:869:in `run_podfile_pre_install_hook'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:857:in `block in run_podfile_pre_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:856:in `run_podfile_pre_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:254:in `block in download_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:252:in `download_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:161:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

@mfazekas
Copy link
Contributor Author

mfazekas commented Mar 7, 2021

@mfazekas
I have update added in pod:

pre_install do |installer|
    $RNMBGL.pre_install(installer)
  end

  post_install do |installer|
    $RNMBGL.post_install(installer)
  end

commenting in pod
# pod "react-native-mapbox-gl", :path => "../node_modules/@react-native-mapbox-gl/maps"

Do i need to update following in my project:
example/ios/RNMapboxGLExample.xcodeproj/project.pbxproj
react-native-mapbox-gl.podspec

because i am getting following error:

[!] An error occurred while processing the pre-install hook of the Podfile.
undefined method `pre_install' for nil:NilClass
/Users/mac1/Users/Khurshid/Projects/OnwaniClick/Source/OnwaniClick/ios/Podfile:26:in `block (3 levels) in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:162:in `pre_install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:869:in `run_podfile_pre_install_hook'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:857:in `block in run_podfile_pre_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:856:in `run_podfile_pre_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:254:in `block in download_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:252:in `download_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:161:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

It's likely because you haven't updated to #masterof rnmbgl

@westanvv
Copy link

@ansarikhurshid786, I have the same problem. Try to delete node_modules, Pods and lock files (in my case this is yarn.lock). Then reinstall npm modules and pods.
The dependency in package.json should look like "@react-native-mapbox-gl/maps": "github:react-native-mapbox-gl/maps#master"

@ferdicus ferdicus deleted the fix-ios-archive branch March 12, 2021 12:52
@ferdicus ferdicus restored the fix-ios-archive branch March 12, 2021 12:52
@NathanNovak
Copy link

NathanNovak commented Mar 30, 2021

I get a corrupt archive and keep getting this error when trying to upgrade to 8.2.0-beta1:

npm ERR! Could not resolve dependency: npm ERR! peer react@"^16.6.1" from @react-native-mapbox-gl/maps@8.2.0-beta1 npm ERR! node_modules/@react-native-mapbox-gl/maps npm ERR! @react-native-mapbox-gl/maps@"8.2.0-beta1" from the root project
Can someone let me know how to solve this.

"react": "17.0.1",
"react-native": "0.64.0",

NathanNovak referenced this pull request in StraboSpot/StraboSpot2 Mar 31, 2021
…post installs (https://github.com/react-native-mapbox-gl/maps/pull/1262).  Had to use '--legacy-peer-deps' flag to override dependency error.

Had to downgrade @sentry/cli to 1.63.0 cause of xcode error about script not loading.

Signed-off-by: NathanNovak <nnovak@ku.edu>
@mzu
Copy link
Contributor

mzu commented Apr 29, 2021

hey @mfazekas , does this maybe warrant a new release too?
Edit: How were you able to built /example?
I'm getting this error when trying:

example/ios/Pods/Headers/Public/libevent/event.h:44:10: fatal error: 'event2/event-config.h' file not found
#include <event2/event-config.h>

Which seems to be linked to Flipper
putting this in the Podfile fixes the issue:
45: use_flipper!({ 'Flipper' => '0.76.0' })
Or we just comment the flipper part out and leave it to users to uncomment if they want to use it (and know what they're doing)

This facebook/react-native#30836 recommends this workaround:

use_flipper!({ 'Flipper-Folly' => '2.3.0' })

Yeah, one of the two will do the trick. ✅

After I got that working, I actually tried to disable Flipper all together (looking into adding an iOS build action).
However, when I try the recommended "comment out flipper stuff in the Podfile" I get an error message AppDelegate.m: 'FlipperKit/FlipperClient.h' file not found.

I guess it still tries to import those files, although Flipper is disabled...
Setting FB_SONARKIT_ENABLED to 0 in example/ios/RNMapboxGLExample.xcodeproj/project.pbxproj also doesn't seem to help here 😕

Any clues?
Cheers 🍻 have a good weekend

@ferdicus did you find out how to prevent the imports that cause the error AppDelegate.m: 'FlipperKit/FlipperClient.h' file not found when Flipper gets disabled via Podfile?

I had to temporarily disable Flipper because it is causing all sorts of problems with the new version of XCode (12.5). Once disabled AppDelegate.m is still causing the problems you have described. 🤔

Update:
I managed to skip the Flipper initialisation inside AppDelegate.m by replacing all

#ifdef FB_SONARKIT_ENABLED

with

#if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)

@ferdicus
Copy link
Member

hey @mzu, check out this part of the example/ios/Podfile
https://github.com/react-native-mapbox-gl/maps/blob/05490d25e595e9b919135a8ef2910ee7858aa55c/example/ios/Podfile#L55-L72

just a dumb if else clause

when building on GH-Actions it will not not include Flipper, locally it adds it.

@mzu
Copy link
Contributor

mzu commented Apr 29, 2021

hey @mzu, check out this part of the example/ios/Podfile
https://github.com/react-native-mapbox-gl/maps/blob/05490d25e595e9b919135a8ef2910ee7858aa55c/example/ios/Podfile#L55-L72

just a dumb if else clause

when building on GH-Actions it will not not include Flipper, locally it adds it.

Thanks @ferdicus . The issue I had was more related to the FB_SONARKIT_ENABLED flag (after already successfully disabling flipper inside the Podfile). I set FB_SONARKIT_ENABLED to 0 in the XCode's build settings but this didn't seem to affect the AppDelegate.m import block (similar to your description). This is why I added the extra __has_include(<FlipperKit/FlipperClient.h>) check inside AppDelegate.m.

@ferdicus ferdicus deleted the fix-ios-archive branch August 20, 2021 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS 8.1.0-rc: Xcode 'Archive' produces a corrupt archive
7 participants