簡體   English   中英

將react native集成到現有的Swift項目中:找不到'string'文件

[英]Integrate react native into existing Swift project: 'string' file not found

我根據此教程嘗試將React Native集成到我現有的iOS應用程序(混合代碼ObjC和Swift)中: https ://facebook.github.io/react-native/docs/integration-with-existing-apps.html

但是,每當我嘗試編譯我的項目時,我都'string' file not found (還有一個問題: https : //github.com/facebook/react-native/issues/17556但還沒有解決方案)。

有人解決了這個問題嗎?

我們最近在通過CocoaPods集成RN時也遇到了這一問題。

不知道您是否仍在尋找解決方案,但是正如esam091在所鏈接的問題中所述,一種解決方法是在Podfile中添加此后安裝掛鈎。

# 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 "YGNode.h"
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

這將刪除罪魁禍首。 從RN 0.53開始仍然是一個問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM