React-Native应用中的ARM64建筑符号未定义
我正在尝试在反应本机中使用React微视角。为此,我试图使用React-Native-Native static-server在本地服务器中为React App构建服务,并在Web视图中使用它。但是,当我为iOS运行时,我将面对这个问题;
Undefined symbols for architecture arm64:
"_RCTRegisterModule", referenced from:
+[FPStaticServer load] in FPStaticServer.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
将构建文件复制到iOS应用程序的根,这是我的反应代码。
import React, {FC, useEffect, useState} from 'react';
import RNFS from 'react-native-fs';
import StaticServer from 'react-native-static-server';
import WebView, {WebViewProps} from 'react-native-webview';
export type TpWebPortalProps = {} & WebViewProps;
const TpWebPortal: FC<TpWebPortalProps> = () => {
const [source, setSource] = useState('');
useEffect(() => {
const path = RNFS.MainBundlePath + '/portals/count';
const server = new StaticServer(8080, path);
server.start().then(url => {
setSource(url);
console.log('Serving at URL', url);
});
return () => {
server.stop();
};
}, []);
return (
<WebView
style={{flex: 1}}
source={{
uri: source
}}
originWhitelist={['*']}
javaScriptEnabled
domStorageEnabled
allowFileAccess
/>
);
};
export default TpWebPortal;
I am trying to use a react microfrontend in react-native. To do this, i am trying to serve react app build in local server with react-native-static-server and use it inside web-view. But, i am facing with this problem when i run it for ios;
Undefined symbols for architecture arm64:
"_RCTRegisterModule", referenced from:
+[FPStaticServer load] in FPStaticServer.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The build file is copied to root of ios app and here is my react-native code;
import React, {FC, useEffect, useState} from 'react';
import RNFS from 'react-native-fs';
import StaticServer from 'react-native-static-server';
import WebView, {WebViewProps} from 'react-native-webview';
export type TpWebPortalProps = {} & WebViewProps;
const TpWebPortal: FC<TpWebPortalProps> = () => {
const [source, setSource] = useState('');
useEffect(() => {
const path = RNFS.MainBundlePath + '/portals/count';
const server = new StaticServer(8080, path);
server.start().then(url => {
setSource(url);
console.log('Serving at URL', url);
});
return () => {
server.stop();
};
}, []);
return (
<WebView
style={{flex: 1}}
source={{
uri: source
}}
originWhitelist={['*']}
javaScriptEnabled
domStorageEnabled
allowFileAccess
/>
);
};
export default TpWebPortal;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论