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

OneSignal/OneSignal.h file not found #161

Closed
haxtrujillo opened this issue Jan 24, 2017 · 44 comments
Closed

OneSignal/OneSignal.h file not found #161

haxtrujillo opened this issue Jan 24, 2017 · 44 comments
Assignees

Comments

@haxtrujillo
Copy link

There was and issue already opened and closed, but this is still and issue. See issue 133.

My comment on the issue describes the problem.

React Native 0.40.0 OneSignal 3.0

@avishayil
Copy link
Contributor

So basically it means that the framework is not updated on the module, if you choose not to use CocoaPods. Am I correct?

@haxtrujillo
Copy link
Author

Yes, I think that is correct. I am not using CocoaPods.

@avishayil
Copy link
Contributor

I see. The current problem is that I can't find any way to make the library recognize the framework if it's outside the library, for example in the Frameworks group on the Xcode project. That makes the library dependent on a specific version of the framework, rather than adding it manually.

@vedovato
Copy link

Hey, found a repo with hints for you. Made my code work again.
https://github.com/eriksape/react-native-onesignal#faq-repeating-issues

@haxtrujillo
Copy link
Author

@avishayil,

I not really familiar with objective-c, I really wish I could help solve the problem.
Could there be an update to the documentation to let people know about the issue?

In the mean time I copied the OneSignal.framework directory into my ios project with the right "Header" directory and "OneSignal" file and changed the "Framework Search Paths" to point to it.

I will have to keep and eye for updates, but this works for me for now. Thanks!

@dguillamot
Copy link

@haxtrujillo Also running into this issue when not using CocoaPods. Which Header file and OneSignal file did you change to make this work via direct import instead of the official README instructions? Thanks!

@haxtrujillo
Copy link
Author

@dguillamot make sure to set the "Header Search Paths" and "Header Search Paths", copy the files from version "B" (Current) two levels up.

screen shot 2017-01-25 at 11 13 26 pm

@avishayil
Copy link
Contributor

I'm still wondering how to solve it without this "ugly" way. @jkasten2 can you help here?

@avishayil avishayil self-assigned this Jan 26, 2017
@avishayil avishayil added the bug label Jan 26, 2017
@bitsal
Copy link
Contributor

bitsal commented Jan 26, 2017

I have the same issue, plus React/<...>.h not found.
screen shot 2017-01-26 at 2 31 54 pm

@rustykey
Copy link

screen shot 2017-01-26 at 7 37 18 pm

I also have same issue with React-Native 0.4.0,

After install some plugin(react-native-firestack), suddenly it happens.

@dguillamot
Copy link

dguillamot commented Jan 26, 2017

@rustykey @bitsal

I had to do 2 separate things to get it working:

0 - I created a subfolder in my main project folder (where the xcode workspace file is) called /ios/OneSignal

1 - Then, similar to what haxtrujillo said above, in the node_modules/react-native-onesignal/ios/Frameworks folder, you can double-click / expand the OneSignal.framework file. Inside there is a Versions/B subfolder. Select the 'Headers' and 'OneSignal' files in there, copy ( CMD-C ) and then select the OneSignal.framework 'file' again and paste .

Then, I copied this new OneSignal.framework file into the /ios/OneSignal folder I made above in step 0.

2 - Next, I copied the node_modules/react-native-onesignal/ios/RCTOneSignal.xcodeproj file and the RCTOneSignal folder over to the ios/OneSignal folder I made in step 0.

Then in Xcode, I added the OneSignal.Framework file into the Frameworks folder of my xcode workspace, and added the RCTOneSignal.xcodeproj to the Libraries folder. Then, I selected the xcodeproj file in my Libraries folder in xcode. Checking that the target was RCTOneSignal, I went to BuildSettings, and changed Framework Search Paths to be '$(PROJECT_DIR)/OneSignal' .. That way it could find the new OneSignal.framework I made. I also changed Header Search Paths in the same Build Settings area to make sure that it was picking up React. In my case, it was easiest to do it relative to PROJECT_DIR as '$(PROJECT_DIR)/../node_modules/react-native/React'

After these changes, everything is now in my ios/OneSignal folder and I don't really need the node_modules folder at all. I am still using it though, for Android. But if you are ios only, you don't need the node_module folder as this workaround has basically made a local copy.

This is definitely not a good long term solution and should be undone once the author has updated this package. It's just short-cutting the node module by copying the project over so you can change the Build Settings. Once the node module is modified to fix this issue, these changes should be undone.

@bitsal
Copy link
Contributor

bitsal commented Jan 26, 2017

Thank you @dguillamot !

I've done it in a bit different way but sense is the same I guess
package.json:

"scripts": {
     ...
    "fix-onesignal-ios-issue-161": "cd node_modules/react-native-onesignal/ios/Frameworks/OneSignal.framework && cp -R Versions/B/* . && cd ../../../../..",
    "run-ios": "npm run fix-onesignal-ios-issue-161 && echo '.env.local' > /tmp/envfile && react-native run-ios",
     ...
}

P.S.:
@avishayil
I noticed in RCTOneSignal project's Header Search Paths a line like this "$(SRCROOT)/../../../ios/Pods/Headers/Public/OneSignal".
It seems library requires me to have node_modules and ios folders on the same level. In some cases (when project structure is a bit different) it won't work because there is no folder $(SRCROOT)/../../../ios.

P.S. 2:
Also, I had an issue like React/RCT<...>.h file not found. I've fixed by building React first from the XCode (see facebook/react-native#12042 (comment)).

react-native run-ios doesn't work yet (, only from XCode.

@jkasten2
Copy link
Member

There hasn't been a Versions/B folder since version 2.1.5 of the native iOS OneSignal SDK. Can you check to make sure your pulling in the latest OneSignal.framework? Currently 2.3.5 is that latest.

@bitsal
Copy link
Contributor

bitsal commented Jan 27, 2017

@jkasten2 right, 2.3.5 version now
I'm sure because I many times run

rm -rf node_modules/react*
rm -rf ios/build/* && rm -rf ios/Pods/*
rm -rf ~/Library/Developer/Xcode/DerivedData/*

BTW,

react-native-cli: 2.0.1
react-native: 0.40.0

Podfile:

pod 'OneSignal', '~> 2.0'

but actually it installs 2.3.5, I see it in the console output

@haxtrujillo
Copy link
Author

@jkasten2,
I am using React Native 0.40.0, OneSignal 3.0 and no CocoaPods.

@bitsal
Copy link
Contributor

bitsal commented Jan 27, 2017

@jkasten2
You are right. There is no Versions/B folder in ios/Pods/OneSignal/iOS_SDK/Framework/OneSignal.framework/Versions/:

A
Current -> A

but Versions/B is still here node_modules/react-native-onesignal/ios/Frameworks/OneSignal.framework/Versions/

package.json
"react-native-onesignal": "3.0.0",

@jkasten2
Copy link
Member

The issue seems to be missing symlinks from the 3.0.0 release tag.

@avishayil I noticed that the v3.0.0 tag is missing them but master has them.
https://github.com/geektimecoil/react-native-onesignal/tree/v3.0.0/ios/Frameworks/OneSignal.framework
https://github.com/geektimecoil/react-native-onesignal/tree/master/ios/Frameworks/OneSignal.framework

The native iOS SDK repo also has symlinks here.
https://github.com/OneSignal/OneSignal-iOS-SDK/tree/2.3.5/iOS_SDK/Framework/OneSignal.framework

Can you release an update with these missing files?

@avishayil
Copy link
Contributor

@jkasten2 There you go, in this project at the examples branch:
https://github.com/geektimecoil/react-native-onesignal/tree/examples/examples/RNOneSignalFramework

Try to build this project, it says it's missing the header files.

@jkasten2
Copy link
Member

jkasten2 commented Feb 2, 2017

@avishayil I did a fresh clone and following the instructions below but didn't run into a missing .h issue.
https://github.com/geektimecoil/react-native-onesignal#running-example-project

Note: The instructions should be cd OneSignalRN instead of cd OneSignalRNExample.

Ran the project from both the terminal as the instructions noted and built from Xcode directly by opening the RNOneSignal.xcworkspace file.

@avishayil
Copy link
Contributor

Hi @jkasten2, no problem when building a project with CocoaPods. Problem is when trying to build a project with the framework without CocoaPods.

@GeoffreyPlitt
Copy link

I mentioned this before, forgive me if this is a duplicate but: One of the problems is that the header file OneSignal.h IS in the repo, but they are not under a folder called "OneSignal" which is how they are referenced.

@eriksape
Copy link
Contributor

eriksape commented Feb 2, 2017

@avishayil is still the problem without cocoa?, sorry for didn't notice it, let me see guys and am going to let you know :)

@avishayil
Copy link
Contributor

@eriksape yep

@eriksape
Copy link
Contributor

eriksape commented Feb 3, 2017

@avishayil I don't know what happen, my method to insert is still Ok, as I see cocoa pods do the same thing but automatically and downloading a lot of packages with the last version of OneSignal-iOS-SDK as said by @jkasten2 is the 2.3.5, know you downgrade the version of the sdk now?

@kelset
Copy link

kelset commented Feb 4, 2017

Guys I have the header issue when using v2 and Cocoapods :/ Any hint on why? Should I create a dedicated issue?

@avishayil
Copy link
Contributor

I'll have a look on v2 this week.

@edo1493
Copy link

edo1493 commented Feb 6, 2017

I am on RN40 and OneSignal3.0, using the Framework and still getting "OneSignal/OneSignal.h not found". My header / framework paths are correctly set, the library has been linked with react-native link, so I don't see any issue regarding setup.

I had the same with Cocoapods though.

@larryranches
Copy link

larryranches commented Feb 6, 2017

I was having this error for v3.0.0 and react native 0.41. I got it to build by running the command react-native link.

Correction: still getting a build error :(

@avishayil
Copy link
Contributor

Are you guys using CocoaPods?

@larryranches
Copy link

@avishayil No, I'm not using Cocoapods and will not be using it. I just got your latest changes in 3.0.2 and it's still not building. Any updates on fixing this?

@avishayil
Copy link
Contributor

@larryranches This is still something i'm looking at alongside OneSignal's team. @jkasten2 and I will update when we have a solution for this.

@larryranches
Copy link

@avishayil Thanks for looking into this! Would be nice to get this working as we have to upgrade to the latest React Native 0.41. Please let us know once there's a fix.

@lopezjurip
Copy link

Same issue when running with Xcode. App starts with node node_modules/react-native/local-cli/cli.js run-ios but crashed because RNOneSignal is undefined.

@edo1493
Copy link

edo1493 commented Feb 7, 2017

@avishayil I have tried to use Coca and the Framework, same result.

@avishayil
Copy link
Contributor

avishayil commented Feb 7, 2017

@edo1493 can you share a repo with the error reproduced?

@lopezjurip
Copy link

This pull-request worked for me ✌️:
#184

@avishayil
Copy link
Contributor

Interesting, how did you build it? From scratch or to an existing project?

@lopezjurip
Copy link

@avishayil into a existing project (with the problem described here) and followed the updated README at https://github.com/jkasten2/react-native-onesignal.
(Had to remove Podfile and related files)

@larryranches
Copy link

PR #184 works for me as well

@avishayil
Copy link
Contributor

Merged, tested and fixed.

@SupriyaAdep
Copy link

i have done all the things still its not found :(

@martinezguillaume
Copy link

I have this error too with Cacaopods ... RN 0.50 and react-native-onesignal ^3.0.5

@minhmera
Copy link

minhmera commented Jan 9, 2018

anyone fix this bug ? i am facing on RN 0.51 and react-native-onesignal ^3.0.5

@asleepace
Copy link

Reinstalling one signal from scratch helped me fix this issue.

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

No branches or pull requests