React 原生语义问题:重新定义"方法描述符"



应用程序react原生应用程序在模拟器上编译得很好,但当我试图从xcode在iphone上运行它时,我会收到以下错误:

语义问题:

1-"MethodDescriptor"的重新定义-包含在路径/rect native/RectCommon/cxrect/ModuleRegistry.cpp:10:中的文件中

2-"NativeModule"的重新定义-1。在react-path/nature/RectCommon/cxrreact/ModuleRegistry.cpp:10:中包含的文件中

精细React cxxrreact/NativeModule.h 上的代码

// Copyright (c) Facebook, Inc. and its affiliates.
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
#pragma once
#include <string>
#include <vector>
#include <folly/Optional.h>
#include <folly/dynamic.h>
namespace facebook {
namespace react {
struct MethodDescriptor {
std::string name;
// type is one of js MessageQueue.MethodTypes
std::string type;
MethodDescriptor(std::string n, std::string t)
: name(std::move(n))
, type(std::move(t)) {}
};
using MethodCallResult = folly::Optional<folly::dynamic>;
class NativeModule {
public:
virtual ~NativeModule() {}
virtual std::string getName() = 0;
virtual std::vector<MethodDescriptor> getMethods() = 0;
virtual folly::dynamic getConstants() = 0;
virtual void invoke(unsigned int reactMethodId, folly::dynamic&& params, int callId) = 0;
virtual MethodCallResult callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic&& args) = 0;
};

}}

我通过终端执行"pod install"命令,然后在Xcode中清理和重建我的项目,解决了这个问题。

最新更新