[Bug]: OneSignal/OneSignal.h file not found
What happened?
Hello, im currently trying to do Archive on my XCode and failing with Lexical or Preprocessor Issue => OneSignal/OneSignal.h file not found
Already tried reinstalling pods and creating a new notifications extension following the installation guide.
Steps to reproduce?
XCode 13
IOS 13
React Native 0.63.4
Steps on XCode
1. Clean build
2. Archive
What did you expect to happen?
I expected to complete the xcode archive.
React Native OneSignal SDK version
4.3.3
Which platform(s) are affected?
- [X] iOS
- [ ] Android
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Facing same issue with following environment:
System:
OS: macOS 12.5
CPU: (10) arm64 Apple M1 Pro
Memory: 124.86 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.17.1 - ~/.nvm/versions/node/v16.17.1/bin/node
Yarn: 1.18.0 - ~/.nvm/versions/node/v16.17.1/bin/yarn
npm: 8.18.0 - ~/Documents/rippling-mobile/node_modules/.bin/npm
Watchman: 2022.10.03.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9014738
Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.68.2 => 0.68.2
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
react-native-onesignal version according to yarn.lock:
[email protected]:
resolved "https://registry.yarnpkg.com/react-native-onesignal/-/react-native-onesignal-4.4.0.tgz#731651bf074bac7d5e1576e8670a5850aacce362"
Onesignal contents in Podfile.lock:
- OneSignalXCFramework (3.11.2):
- OneSignalXCFramework/OneSignalCore (= 3.11.2)
- OneSignalXCFramework/OneSignalExtension (= 3.11.2)
- OneSignalXCFramework/OneSignalOutcomes (= 3.11.2)
- OneSignalXCFramework/OneSignalCore (3.11.2)
- OneSignalXCFramework/OneSignalExtension (3.11.2):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalOutcomes
- OneSignalXCFramework/OneSignalOutcomes (3.11.2):
- OneSignalXCFramework/OneSignalCore
Have the same problem, but on a different package version.
react-native-onesignal@^4.4.1
The environment is the same:
- Xcode 14.0.1
- arm64 Apple M1
- macOS 12.5
- react-native 0.70.3
I see this in Debug builds and not on Release configuration, e.g. react-native run-ios will break.
Facing the same issue with Xcode 14, but can achieve success.
the same issuse
The solution seems to be:
If you are excluding arm64 via excluded architechtures build setting,
Make sure it is excluded for all targets (even the pods project).
After doing the above, error should not appear.
OneSignal/OneSignal.h is in https://documentation.onesignal.com/docs/react-native-sdk-setup
Please see "Manually updating iOS OneSignalNativeSDK" above step 6. Then download "Source code" and do the step in manually.
[Update] If you install all of package. then you open file.xcworkspace and build It's work for me.
! file.xcodeproj has some bug
rm -rf node_modules
pod deintegrate
yarn
pod install
Fixed for me!
Xcode 15.0 beta 3 has same problem with M2 Mac
Has anyone found any solution for this? I get the same error: 'OneSignal/OneSignal.h' file not found
I think the documentation was updated and needs to be updated to OneSignalFramework/OneSignalFramework.h
I am having the same issue. I use latest Expo (SDK 49.0.0), and we have tweaked the `onesignal-expo-config' to add to podFile:
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignalXCFramework', '>= 5.0', '< 6.0'
use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
end`;
I can see it installs:
[INSTALL_PODS] Installing react-native-onesignal (5.0.0)
[INSTALL_PODS] Installing OneSignalXCFramework (5.0.1)
But when fastlane is run I get the dreaded:
(ios/OneSignalNotificationServiceExtension/NotificationService.m:1:9)
> 1 | #import <OneSignal/OneSignal.h>
| ^ 'OneSignal/OneSignal.h' file not found
Any idea?
I am having the same issue. I use latest Expo (SDK 49.0.0), and we have tweaked the `onesignal-expo-config' to add to podFile:
target 'OneSignalNotificationServiceExtension' do pod 'OneSignalXCFramework', '>= 5.0', '< 6.0' use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks'] end`;I can see it installs:
[INSTALL_PODS] Installing react-native-onesignal (5.0.0) [INSTALL_PODS] Installing OneSignalXCFramework (5.0.1)But when fastlane is run I get the dreaded:
(ios/OneSignalNotificationServiceExtension/NotificationService.m:1:9) > 1 | #import <OneSignal/OneSignal.h> | ^ 'OneSignal/OneSignal.h' file not foundAny idea?
for this issue, I've used patch-package to not only update the iosContants but also the support/serviceExtensionFiles/NotificationService.m and replace
#import <OneSignal/OneSignal.h>
with
#import <OneSignalFramework/OneSignalFramework.h>
since react-native-onesignal uses OneSignalFramework header now instead of OneSignal, works for me @killerchip
same issue here.
I spent all of the day to resolve it but nothing worked.
'OneSignal.h' file not found
same issue here.
I spent all of the day to resolve it but nothing worked.
'OneSignal.h' file not found
@Diaa-Ghonim See @aindong response https://github.com/OneSignal/react-native-onesignal/issues/1440#issuecomment-1710521746
same issue here. I spent all of the day to resolve it but nothing worked.
'OneSignal.h' file not found@Diaa-Ghonim See @aindong response #1440 (comment)
it is not a completed answer, which parts I have to patch them. and I am not using expo I am using react-native and I use react-native-onesignal 4.4.1
and I added this to my pod file
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
end
anyone can explain clear steps please to fix this issue??
my machine is mac m1 my xcode is 14.3
1.3.2 [Bug]: 'onesignal/onesignal.h' file not found react native OneSignal/onesignal-expo-plugin#182
it should be pod 'OneSignalXCFramework', '>= 5.0', '< 6.0' (see versions)
Also check if you have a NotificationService.m file. Replace
#import <OneSignal/OneSignal.h>
with
#import <OneSignalFramework/OneSignalFramework.h>
1.3.2 [Bug]: 'onesignal/onesignal.h' file not found react native OneSignal/onesignal-expo-plugin#182
it should be
pod 'OneSignalXCFramework', '>= 5.0', '< 6.0'(see versions)Also check if you have a
NotificationService.mfile. Replace#import <OneSignal/OneSignal.h>with#import <OneSignalFramework/OneSignalFramework.h>I apologize for any confusion. Here's a corrected version in English:
Unfortunately, the issue remains unresolved. I upgraded the react-native-onesignal library to the latest version and updated the Podfile from version 5 to 6. However, I'm still encountering this error:
'OneSignalFramework/OneSignalFramework.h' file not found
I am using react-native version "0.63.3".
https://documentation.onesignal.com/docs/ios-sdk-setup#4-notification-service-extension
maybe in the objective-c file, write OneSignalExtension where you have OneSignal or OneSignalFramework ?
#import <OneSignalExtension/OneSignalExtension.h>
instead of
#import <OneSignal/OneSignal.h> // or #import <OneSignalFramework/OneSignalFramework.h>
not sure about it though, but at home it seems to compile