Closed brunoleitem closed 11 months ago
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
:
react-native-onesignal@4.4.0:
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:
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 found
Any 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.m
file. 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
Here is the issue in this file in node_modules.
any idea?
I confirm on my side: for OneSignal v5+, I replace #import < OneSignalFramework/OneSignalFramework .h>
or #import <OneSignal/OneSignal.h>
with
#import <OneSignalExtension/OneSignalExtension.h>
and it's compiling
Hello @arnaudambro,
Thank you for your reply.
Where exactly should I add this line?
Here is my react-native-onesignal package in node_modules (version 4.4.1) (first image).
And here, as well, is the pods file and the react-native-onesignal pod (second image).
So, what should I do exactly to make the compilation succeed?
you should have a Notification Service Extension: https://documentation.onesignal.com/docs/ios-sdk-setup#4-notification-service-extension
quoting:
The OneSignalNotificationServiceExtension allows your iOS application to receive rich notifications with images, buttons, and badges. It's also required for OneSignal's Confirmed Delivery analytics features. In Xcode Select File > New > Target... Select Notification Service Extension then press Next. Enter the product name as OneSignalNotificationServiceExtension and press Finish. Do not select Activate on the dialog that is shown after selecting Finish. Press Cancel on the Activate scheme prompt. By canceling, you are keeping Xcode debugging your app, instead of the extension you just created. If you activated by accident, you can switch back to debug your app within Xcode (next to the play button). In the project navigator, select the top-level project directory and select the OneSignalNotificationServiceExtension target in the project and targets list. Ensure the Deployment Target is set to the same value as your Main Application Target. Unless you have a specific reason not to, you should set the Deployment Target to be iOS 11 or above. In the project navigator, click the OneSignalNotificationServiceExtension folder and open the NotificationService.m or NotificationService.swift and replace the whole file's contents with the following code. Ignore any build errors at this point. We will import OneSignal which will resolve any errors.
#import <OneSignalExtension/OneSignalExtension.h>
#import "NotificationService.h"
@interface NotificationService ()
@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property (nonatomic, strong) UNNotificationRequest *receivedRequest;
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
...
this is where the OneSignal/OneSignal.h file not found
comes from, because it used to be #import <OneSignal/OneSignal.h>
, now it's #import <OneSignalExtension/OneSignalExtension.h>
For expo users, new update on the expo plugin is out, it should fix your problems about the missing header https://github.com/OneSignal/onesignal-expo-plugin/releases/tag/2.0.0
I have a Mac M1, react native 0.68.5 and OneSignal 4.5.0. For some reason cocoapods is not installing correctly pods so, after weeks dealing with this issue, I've fixed it doing the following steps:
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
I have only those, if you have another one that can cause and error you need to remove it.
rm -rf node_modules && yarn install
cd ios && pod deintegrate
rm -rf podfile.lock
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod install
npx react-native run ios (or the command that you use to run it)
I hope this helps!
olá consegui resolver alterando
#import <OneSignalFramework/OneSignalFramework.h>
para
#import <OneSignal/OneSignal.h>
Versão:
OneSignal 4.5.1, React-native 0.72.4, Xcode 15.0, macOS ventura 13.5.2,
I tried all these solutions but didn't fix the issue.
any help please?
I have a Mac M1, react native 0.68.5 and OneSignal 4.5.0. For some reason cocoapods is not installing correctly pods so, after weeks dealing with this issue, I've fixed it doing the following steps:
- Update cocoapods and ffi to last version.
- Delete from podfile everything related with OneSignal. And add this:
post_install do |installer| react_native_post_install(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer) end
- On Xcode, open xcworkspace, go to OneSignalNotificationServiceExtension target > General > Frameworks and Libraries and add:
![]()
I have only those, if you have another one that can cause and error you need to remove it.
- Do a full clean and run it again:
rm -rf node_modules && yarn install cd ios && pod deintegrate rm -rf podfile.lock rm -rf ~/Library/Developer/Xcode/DerivedData/* pod install npx react-native run ios (or the command that you use to run it)
I hope this helps!
Adding the .xcframework files into the Frameworks and Libraries of OneSignalNotificationServiceExtension worked for me
I have a Mac M1, react native 0.68.5 and OneSignal 4.5.0. For some reason cocoapods is not installing correctly pods so, after weeks dealing with this issue, I've fixed it doing the following steps:
- Update cocoapods and ffi to last version.
- Delete from podfile everything related with OneSignal. And add this:
post_install do |installer| react_native_post_install(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer) end
- On Xcode, open xcworkspace, go to OneSignalNotificationServiceExtension target > General > Frameworks and Libraries and add:
![]()
I have only those, if you have another one that can cause and error you need to remove it.
- Do a full clean and run it again:
rm -rf node_modules && yarn install cd ios && pod deintegrate rm -rf podfile.lock rm -rf ~/Library/Developer/Xcode/DerivedData/* pod install npx react-native run ios (or the command that you use to run it)
I hope this helps!
Adding the .xcframework files into the Frameworks and Libraries of OneSignalNotificationServiceExtension worked for me
finally worked with me too
Thanks a lot ❤️ 🤙 ❤️
@nachoviejo @sn-will
After adding OneSignal.xcframework ,.... I got another error:
Library not found for -lPods-OneSignalNotificationServiceExtension
My environment: react-native: 0.63 xcode 14.2 macbook: M2-pro
Tried every sugestion here but none work.... Xcode Version 15.0 react-native: 0.72.6 macbook: intel
Unfortunately, this issue has occurred again, and I attempted the same solution, but it did not work.
help again guys 😢 😞
I got rid of this error by
1 pod deintegrate
2 pod update
3 Remove arm64
from excluded architecture at project and targets level
It's curious that I had to exclude the architecture and build to solve this problem
Then the import error appeared so I though by removing the excluded arch the linking error would show again but it didn't.
I'm not an expert on the topic but I think deintegrating and updating doesn't affect all files for some reason, I noticed the "OneSignal/OneSignal.h file not found" error I had was in the Development Pods folder I manually deleted everything in this folder and ran pod update
again. this seemed to have resolved the problem for me.
Hello i am getting this error while building ipa from unity
error : 'OneSignalNotifications/OneSignalNotifications.h' file not found
from past 2 days i am battling with this error please help guysss
Same issue here!
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?
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?
Relevant log output
No response
Code of Conduct