React-native-onesignal: OneSignal/OneSignal.h file not found

Created on 7 Jan 2017  ·  40Comments  ·  Source: OneSignal/react-native-onesignal

Hi - the previous issue for this was closed, so I'm starting a new one.

I'm on RN 0.39, and I did 'react-native-link' as well as following every instruction from the README, but we do not use Pods, so I don't have any Podfiles to update. How do I do this without Podfiles?

Still getting the error above.

Most helpful comment

@eriksape I'm not sure what you're asking, I'm not putting the framework anywhere. I run "yarn install" and the framework shows up under node modules.

After installing v2.0.0, I go into node_modules/react-native-onesignal and look for myself:

$ find . | grep OneSignal.h
./ios/Frameworks/OneSignal.framework/Versions/A/Headers/OneSignal.h
./ios/Frameworks/OneSignal.framework/Versions/B/Headers/OneSignal.h
./ios/RCTOneSignal/RCTOneSignal.h

There really is no place where "OneSignal/OneSignal.h" exists. The file "OneSignal.h" exists, but not under a folder called "OneSignal". If we can fix this path and get past this build error, my issues will be solved.

All 40 comments

Anyone have a suggestion without Podfiles?

adding the framework search paths with the value

$(SRCROOT)/../node_modules/react-native-onesignal

and adding the OneSignal.framework that is including in this package to the project on xcode

I'm also looking for how I could install it without Pods... is there some doc for it?

@gplopes try what I commented before, i did that and i do not use pods 👍

@eriksape thanks for answering, I added the path as you mentioned but I'm still getting
#import <OneSignal/OneSignal.h> file not found.
I'm using

"react-native": "0.36.1",
"react-native-onesignal": "2.0.0",

@gplopes and added the OneSignal.framework to the project?

if you did it well you would see the linked lib

image

@eriksape, yes, here are the screenshots of xcode.

screen shot 2017-01-16 at 2 54 17 pm

screen shot 2017-01-16 at 2 53 26 pm

I tested with react-native 0.39 but with the "react-native-onesignal": "^1.2.3"

as I see the 1.2.3 works fine with react-native 0.36

@gplopes I added your suggestion to the docs, it should solve the issue.
In any case, I recommend all of you guys to upgrade to 3.0.0.

Thanks!

Of course, if you're using RN up to 0.39, please use v2.

@gplopes Did you ever get it working? I'm having the same problem, with RN=0.39, v2.0.0 of this lib, and I've followed all suggestions about "Linked Frameworks and Libraries" and search paths.

Can you please provide a repo I can test?

I tried to reproduce this in a minimal repo and ran into another error (#139). Maybe you can create a fork of https://github.com/GeoffreyPlitt/react_native_minimal and show us a version that works? If not, I'll reproduce this once I get past the other error.

Note: No cocoapods.

As i said before, with no cocoapods with v1.2.3 works fine.
I dont know why it needs cocoapods

I will use v3 after dependencies in my project can use react-native 0.40

I cut a new branch of that minimal project and switched to 1.2.3 of this library: https://github.com/GeoffreyPlitt/react_native_minimal/tree/onesignal_123

I still get the following error, do you get the same error or does it run fine for you?

In file included from /Users/giro/react_native_minimal/ios/react_native_minimal/AppDelegate.m:10:
In file included from /Users/giro/react_native_minimal/ios/react_native_minimal/AppDelegate.h:11:
../node_modules/react-native-onesignal/ios/RCTOneSignal/RCTOneSignal.h:3:9: fatal error: 'OneSignal/OneSignal.h' file not found
#import <OneSignal/OneSignal.h>
        ^

screen shot 2017-01-18 at 22 25 45
screen shot 2017-01-18 at 22 25 36

Just fine with all the project, no errors, i will upload an example of it

@eriksape can you please make a PR for updating the docs to use the library without CocoaPods? I'll appreciate it.

@avishayil Ok i will send a PR today or tommorrow, which version of OneSignal for ios are you using? seems that OneSignal.framework has missing files, I tested with the 3.0.0 just now.

Yeah I noticed OneSignal.framework is missing header files, which may be the root cause of this issue

Update: @eriksape Was nice enough to fork, fix, and send me a PR, and this branch now works with 1.2.3:

https://github.com/GeoffreyPlitt/react_native_minimal/tree/onesignal_123

However, when I then started using this fix, I noticed that none of my notifications were going through, with the server reporting:

Error: {"invalid_player_ids":["2ebaf054-acce-4ed6-b927-86fffd9d9c30"]}

And that ID there is the exact one that this library provides for me.

I asked OneSignal support about this error, and they said:
This means that the device with this ID is not subscribed to notifications, either because it opted-out of notifications or has uninstalled your app.

Neither of these things is correct for me, so delving further, their support said:

I see you are using a very old version of our SDK. Please update to our latest 2.X SDK to fix the subscription issue. https://documentation.onesignal.com/docs/upgrading-to-ios-sdk-20

Which means: using v1.2.3 allows me to build on iOS, but it still doesn't allow notifications to work. So I'm eager awaiting the v2.0.0 build fixes (with the missing header files) in order to proceed.

=====> Can someone re-open this issue? Since we've got more work to do? Or should I create a new one?

in your android/ios JS you need to create the configuration for the onesignal

something like that is in the docs of this repo

@eriksape I'm already doing Onesignal.configure() successfully, and it is sending me a userId that appears correct.

but in the https://github.com/GeoffreyPlitt/react_native_minimal/tree/onesignal_123 i can't see you doing the configure. Also as I know when the ID is invalid you need to generate new ID.

Oh yes, sorry to confuse you-- I was just using that repo to fix build issues, I have another (private) project where I'm really using this stuff.

When the ID is invalid, how do you generate a new ID? Please keep in mind, I didn't save this ID somewhere, I'm not using an old one. I'm using the one that was generated on the most recent app load, when I called configure().

If needed, I'll add the configure step to that repo to show you

hey @GeoffreyPlitt, I'm jumping back here but I see the conversation is already on the next level. Unfortunately I didn't have time to try again. I hope you guys could figure this out.

@GeoffreyPlitt you are right about 1.2.3 it don't register the the token push to one signal, it would be better try with 2.0.0 of this lib with the OneSingnal.framework of this version https://github.com/OneSignal/OneSignal-iOS-SDK/archive/2.3.5.zip

I hope it works

Yeah guys same steps with 2.0.0 version
screen shot 2017-01-20 at 9 42 43 am

Sorry I tested the 1.2.3 on a simulator when I realized what @GeoffreyPlitt mention that it only compiles OK, use 2.0.0 instead

What's the issue here? or it's alot of issues together in the conversation? Anyway, here's my solution for the title of this issue:
https://github.com/geektimecoil/react-native-onesignal/issues/152#issuecomment-274124225

I've created a new issue, #153, which captures the work left to fix this.

@avishayil thanks for that workaround, but I'm worried that this will make upgrading harder for me in the future, I'm hoping we can actually fix this properly so everything works out of the box.

@GeoffreyPlitt where did you put the OneSignal.framework? notice that with the $(SRCROOT)/../node_modules/react-native-onesignal it needs to be inside the react-native-onesignal route

@avishayil the problem with the 2.0.0 is the same solved in the pull request with the 3.0.0

@eriksape I'm not sure what you're asking, I'm not putting the framework anywhere. I run "yarn install" and the framework shows up under node modules.

After installing v2.0.0, I go into node_modules/react-native-onesignal and look for myself:

$ find . | grep OneSignal.h
./ios/Frameworks/OneSignal.framework/Versions/A/Headers/OneSignal.h
./ios/Frameworks/OneSignal.framework/Versions/B/Headers/OneSignal.h
./ios/RCTOneSignal/RCTOneSignal.h

There really is no place where "OneSignal/OneSignal.h" exists. The file "OneSignal.h" exists, but not under a folder called "OneSignal". If we can fix this path and get past this build error, my issues will be solved.

the OneSignal.framework is the same that is here?

https://github.com/OneSignal/OneSignal-iOS-SDK/archive/2.3.5.zip

@eriksape I don't know?

Here's a public, minimal repo that reproduces the build error: https://github.com/GeoffreyPlitt/react_native_minimal/tree/onesignal

Has any body been able to solve this problem? running into the same issue. React 0.40.0 + OneSignal 3.0

Ok, I solved my problem, this is a temporary fix. There are a fews symlinks in OneSignal.framework.
onesignal

When we run npm install those directories are missing. Downloading them from the project and manually adding them fixes the issue. This is not ideal, Hope this saves people hours of work.

Thanks. It doesn't really help us because our builds go through a CI system and we have scripts that do fresh check-outs. Excited to get this fixed!

Hey @haxtrujillo can I ask you to clarify a bit? I mean, where do you download those symlinks from? The first link you give to OneSignal.framework doesn't show them.
Second, you show a screenshot but I'm not sure, is that the ./node_modules/react-native-onesignal folder?

@kelset,

I opened a new issue, It has more information and how temperately solve it.

The header files are in the versions directory, you have to test what version works for your project.

Was this page helpful?
0 / 5 - 0 ratings