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

[iOS]'string' file not found (since RN 0.52) #17556

Closed
ldshangfeng opened this issue Jan 12, 2018 · 21 comments
Closed

[iOS]'string' file not found (since RN 0.52) #17556

ldshangfeng opened this issue Jan 12, 2018 · 21 comments
Labels
Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@ldshangfeng
Copy link

ldshangfeng commented Jan 12, 2018

Is this a bug report?
Yes

Have you read the Contributing Guidelines?
Yes

Environment:
OS: macOS High Sierra 10.13.2
Node: 7.6.0
Yarn: 0.24.6
npm: 4.1.2
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found

Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: file:submodule/react-native => 0.52.0

Target Platform: iOS (11.1)

Steps to Reproduce
1.the react-native project complied with swift code
2.build project

Expected Behavior
Complied Success.

Actual Behavior
Complied failed.
Xcode shows 'string' file not found".

Reproducible Demo
Every react-native 0.52 or above project with swift has this problem.
The same issues:(facebook/yoga#697)

@ldshangfeng
Copy link
Author

I think the reason is the OC file in React include yoga cpp has .m suffix,but it needs .mm.It builds success in only OC project,but failed in swift project.

@haemi
Copy link

haemi commented Jan 22, 2018

any solution for this?

@fedegl
Copy link

fedegl commented Jan 23, 2018

This is really bad, how can React Native release a new version that is totally unusable for an large subset of their users? Do they even test the releases on Swift?

@ldshangfeng ldshangfeng changed the title 'string' file not found (since RN 0.52) [iOS]'string' file not found (since RN 0.52) Jan 25, 2018
@esam091
Copy link

esam091 commented Jan 25, 2018

Assuming you're using CocoaPods, a generated umbrella header file breaks the build because some of the imported files include C++ headers. I added a post_install script in my Podfile and it seems to work. Hope this helps.

# Podfile

def remove_unused_yoga_headers
    filepath = './Pods/Target Support Files/yoga/yoga-umbrella.h'

    contents = []
    
    file = File.open(filepath, 'r')
    file.each_line do | line |
        contents << line
    end
    file.close

    contents.delete_at(14) # #import "YGNodePrint.h"
    contents.delete_at(14) # #import "Yoga-internal.h"

    file = File.open(filepath, 'w') do |f| 
        f.puts(contents)
    end
end

post_install do | installer |
  remove_unused_yoga_headers
end

@haemi
Copy link

haemi commented Jan 25, 2018

I tried the following:

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
inhibit_all_warnings!

target '...' do
    # Comment this line if you're not using Swift and don't want to use dynamic frameworks
    use_frameworks!

    ...

    pod 'React', :path => '../node_modules/react-native', :subspecs => [
        'Core',
        'CxxBridge', # Include this for RN >= 0.47
        'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
        'RCTText',
        'RCTNetwork',
        'RCTWebSocket', # needed for debugging
        # Add any other subspecs you want to use in your project
        ]
        # Explicitly include Yoga if you are using RN >= 0.42.0
        pod "yoga", :path => "../node_modules/react-native/ReactCommon/yoga"

    # Third party deps podspec link
    pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
    pod 'GLog', :podspec => '../node_modules/react-native/third-party-podspecs/GLog.podspec'
    pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
    
end

def remove_unused_yoga_headers
    filepath = './Pods/Target Support Files/yoga/yoga-umbrella.h'
    
    contents = []
    
    file = File.open(filepath, 'r')
    file.each_line do | line |
        contents << line
    end
    file.close
    
    contents.delete_at(14) # #import "YGNodePrint.h"
    contents.delete_at(14) # #import "Yoga-internal.h"
    
    file = File.open(filepath, 'w') do |f|
        f.puts(contents)
    end
end

post_install do | installer |
    remove_unused_yoga_headers
end

But now I do get RCTTVRemoteHandler.h file not found (inside RCTModalHostView.m).

@esam091
Copy link

esam091 commented Jan 25, 2018

try including tvOS in React subspecs

 pod 'React', :path => '../node_modules/react-native', :subspecs => [
        'Core',
        'CxxBridge', # Include this for RN >= 0.47
        'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
        'RCTText',
        'RCTNetwork',
        'RCTWebSocket', # needed for debugging
+        'tvOS',
        ]

@haemi
Copy link

haemi commented Jan 25, 2018

it goes on and on...

fishhook/fishhook.h file not found in RCTReconnectingWebSocket.m

@esam091
Copy link

esam091 commented Jan 25, 2018

Pretty sure this helps #13198 (comment)

Integrating React Native with CocoaPods has never been a pleasant experience. I'd advise that it is much better to link React Native dependencies by adding the *.xcodeproj files directly to your project rather than using CocoaPods unless you absolutely have to 🙂

@ldshangfeng
Copy link
Author

fishhook/fishhook.h file not found in RCTReconnectingWebSocket.m @haemi

fix #import <fishhook/fishhook.h> to #import "fishhook.h"

@haemi
Copy link

haemi commented Jan 26, 2018

@ldshangfeng wow - it works now, thanks a lot!

@ldshangfeng
Copy link
Author

ldshangfeng commented Jan 26, 2018

@haemi should thanks @esam091 .The post_install script is more important!
If the post_install script doesn't work,you can check yoga-umbrella.h and delete the line 14 (#import "Yoga-internal.h" and #import "YGNodePrint.h") by yourself.I also tested it successfully.

@yuoppp
Copy link

yuoppp commented Jan 29, 2018

@ldshangfeng is that the proper way to fix this issue?

fix #import <fishhook/fishhook.h> to #import "fishhook.h"

@ldshangfeng
Copy link
Author

ldshangfeng commented Jan 30, 2018

@yuoppp see all of comments.It work successfully with CocoaPods only.

@fjtrujy
Copy link

fjtrujy commented Feb 6, 2018

Hello,
Making the approaches that you suggested it generate warnings.
Do you know if there is a way to make the compilation works & remove the warnings?

Thanks

@ldshangfeng
Copy link
Author

ldshangfeng commented Feb 11, 2018

@yuoppp @fjtrujy only wait for official solution. This is temp solution.

@MarkMolina
Copy link

After adding all these "workarounds" it's still not working. Getting the error: Umbrella header for module 'yoga' does not include header 'Yoga-internal.h'

Makes sense because the post_install script removes it....

@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?

I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.

How to ContributeWhat to Expect from Maintainers

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon. labels Feb 24, 2018
@othorin
Copy link

othorin commented Feb 26, 2018

Bad bot. Don't close this. Still an issue even on 0.54.0-rc3.
facebook/yoga#711

@acro5piano
Copy link

It seems that XCode treat "*.h" files as Clang so attempt to compile with gcc. I set a custom rule to build using g++ and the error disappeared (although another errors are occurring in my project)
Could this be a solution?

image

@pqminh
Copy link

pqminh commented Mar 20, 2018

"react": "16.0.0-alpha.12",
"react-native": "^0.47.2",
"react-native-camera": "^1.0.1",
screen shot 2018-03-20 at 2 39 10 pm

@MaheshNandam
Copy link

MaheshNandam commented Apr 16, 2018

After changing from #import "<RCTNetworking/RCTNetworking.h" to "#import "RCTNetworking.h"

got the issue "'RCTNetworking.h' file not found"?

@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests