react-native-notification-banner
react-native-notification-banner copied to clipboard
Header not found error
I am running:
[email protected]
[email protected]
In my Podfile I have added the following, per the instructions:
pod 'BRYXBanner', :git => 'https://github.com/prscX/BRYXBanner.git', :branch => 'master'
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name.include?('BRYXBanner')
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
end
When I run react-native run-ios
I am getting this error:
RNNotificationBanner.h:3:9: fatal error: 'BRYXBanner/BRYXBanner-Swift.h' file not found
#import "BRYXBanner/BRYXBanner-Swift.h"
If I add use_frameworks!
to the Podfile the error goes away.
If I change to use_modular_headers!
the error also goes away.
Both of these settings impact other modules though, and in particular Firebase/Core has a problem when they are on.
Any workaround?
@nickpalmer I found a workaround where I have the same as you in the Podfile (without use_frameworks or use_modular_headers).
Then I followed those instructions (found in another repo):
-
Open the Xcode workspace located inside the
ios
folder of your app, and add an empty Swift file if you don't have at least one:- Select File/New/File...
- Choose Swift file and click Next.
- Name it however you want, select your application target and create it.
- Accept to create Objective-C bridging header.
-
Enter
ios
folder and runpod update
I hope this can help until there's a better answer.
@nickpalmer I found a workaround where I have the same as you in the Podfile (without use_frameworks or use_modular_headers).
Then I followed those instructions (found in another repo):
Open Xcode workspace located inside
ios
folder and add empty Swift file if you don't have at least one:
- Select File/New/File...
- Choose Swift file and click Next.
- Name it however you want, select your application target and create it.
- Accept to create Objective-C bridging header.
Enter
ios
folder and runpod update
I hope this can help until there's a better answer.
Inside my app or notification-banner?
Inside my app or notification-banner?
@SmirnovM91 inside your app
Inside my app or notification-banner?
@SmirnovM91 inside your app
I did it, but it is not working (banner.swift)
I did it, but it is not working (banner.swift)
@SmirnovM91 You do have the bridging header apparently, so thats fine.
Here's what I have at the end of my Podfile if it may help:
target 'FreshmileApp' do
...
use_native_modules!
pod 'BRYXBanner', :git => 'https://github.com/prscX/BRYXBanner.git', :branch => 'master'
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name.include?('BRYXBanner')
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
end
end
Also make sure to run pod update
Other than that I found out out about the bridging header trick from the install instructions of react-native-ble-plx
, you might want to take a look a this repo as well. Unfortunately this method did the trick for me and I don't know any other way to make this work.
I have the same pod file as you, but it is not working, the problem still exists
RNNotificationBanner.h:3:9: fatal error: 'BRYXBanner/BRYXBanner-Swift.h' file not found
I have the same pod file as you, but it is not working, the problem still exists
RNNotificationBanner.h:3:9: fatal error: 'BRYXBanner/BRYXBanner-Swift.h' file not found
@SmirnovM91 Awww, you're right I forgot about that import. I changed it:
-#import "BRYXBanner/BRYXBanner-Swift.h"
+@import BRYXBanner;
I have the same pod file as you, but it is not working, the problem still exists RNNotificationBanner.h:3:9: fatal error: 'BRYXBanner/BRYXBanner-Swift.h' file not found
@SmirnovM91 Awww, you're right I forgot about that import. I changed it:
-#import "BRYXBanner/BRYXBanner-Swift.h" +@import BRYXBanner;
Thanks a lot, it is working now!
Same error with latest version.
.../node_modules/react-native-notification-banner/ios/RNNotificationBanner.h:3:9: 'BRYXBanner/BRYXBanner-Swift.h' file not found
Same error with latest version.
.../node_modules/react-native-notification-banner/ios/RNNotificationBanner.h:3:9: 'BRYXBanner/BRYXBanner-Swift.h' file not found
try to use @ghitier's solution, for me it is working
Same error with latest version. .../node_modules/react-native-notification-banner/ios/RNNotificationBanner.h:3:9: 'BRYXBanner/BRYXBanner-Swift.h' file not found
try to use @ghitier's solution, for me it is working
That does not work either. It started to produce more errors around Banner.
I think the Banner version currently installed does have show or dismiss methods exposed to ObjectiveC. What BRYXBanner version should it install to go with the library?
PS: Android seems to be working fine.
You need to configure Podfile similar to below one:
use_native_modules!
pod 'RNNotificationBanner', :path => '../node_modules/react-native-notification-banner/ios'
use_frameworks!
pod 'BRYXBanner', :git => 'https://github.com/prscX/BRYXBanner.git', :branch => 'master'
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name.include?('BRYXBanner')
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
end
This works in example and other project where I am using. Let me know incase does not work.
Thanks </ Pranav >
The whole problem of this issue is that using "use_frameworks!" breaks about every second react-native module out there, so it would be nice if there was a way to make it work without.
@SmirnovM91 Awww, you're right I forgot about that import. I changed it:
-#import "BRYXBanner/BRYXBanner-Swift.h" +@import BRYXBanner;
That solution works, but it's more of a hack, maybe it's possible to merge such or similar change to the package?
@prscX could you please make a release with this import changed?
also have this issue using latest versions.
@prscX please make a release with the import fix. If I did it manually, it works
Hi, Any update on this? Facing same problem here and I can not do manually modification to the modules.
@ehsanagh Take a look at this https://www.npmjs.com/package/patch-package With patch-package you can manually modify a module and add a post install script to automatically apply it after each install. This way it will work even for ci/cd or after package version bump.
It's a good approach as I've been forced to patch up around 40% of the react native npm packages out there within a month of working with RN. Gotta start hacking stuff sooner or later :)
The whole problem of this issue is that using "use_frameworks!" breaks about every second react-native module out there, so it would be nice if there was a way to make it work without.
@SmirnovM91 Awww, you're right I forgot about that import. I changed it:
-#import "BRYXBanner/BRYXBanner-Swift.h" +@import BRYXBanner;
That solution works, but it's more of a hack, maybe it's possible to merge such or similar change to the package?
Followed this workaround, but I am now running into this error.
module map file '/Users/me/Library/Developer/Xcode/DerivedData/App-amiwxgwwlncvtifvktjjajkbilap/Build/Products/Debug-iphonesimulator/BRYXBanner/BRYXBanner.modulemap' not found