我正在尝试使用独立的Expo应用程序实现PushNotificationIOS.我正在运行SDK 21.0.0(React Native 0.48).
我正进入(状态 React/RCTEventEmitter file not found
我已完成以下步骤:
.xcworkspace项目RCTPushNotification.xcodeproj拖入我的Libraries文件夹libRCTPushNotification.a到App > Build Phases > Link Binary With Libraries$(SRCROOT)/../node_modules/react-native/Libraries在标题搜索路径下添加- 我也试过没有/../.我也在Header Search Paths列表中有一堆Pod.然后我添加了以下内容AppDelegate.m,但当我点击文件(⌘+ click)时,我收到一个问号.
#import <React/RCTPushNotificationManager.h>
Run Code Online (Sandbox Code Playgroud)
如果我将其更改为下面,它可以工作,我可以点击
#import "RCTPushNotificationManager.h"
Run Code Online (Sandbox Code Playgroud)
但是,这是我的问题
当我清理并构建我的项目时,我得到以下错误RCTPushNotificationManager.h:
'React/RCTEventEmitter.h' file not found
Run Code Online (Sandbox Code Playgroud)
小智 16
@Dan我遇到了同样的问题,它也发生在RCTLinking和其他依赖于eventEmitter.h和一个独立的Expo项目的库中.
问题是,自从Expo管理Cocoapods中的React以来,RCTPushNotification没有引用Cocoapods文件React中的React.因此,您应该进入RCTPushNotification.xcodeproj然后进入Targets - RCTPushNotification标头搜索路径并将链接添加到"ios/Pods/Headers/Public/React"并设置为递归.
最简单的方法是导航到你的iOS/Pods/Headers/Public/React,然后将文件夹直接拖放到标题搜索路径的构建设置中,如下图所示.
在此之后最后你必须引用ReactCommon/yoga,ReactCommon/yoga应该在你的'node_modules/react-native/ReactCommon/yoga'中
这对我适合独立世博会项目
"react": "16.6.3",
"react-native": "0.58.6",
Run Code Online (Sandbox Code Playgroud)
添加'RCTPushNotification'到您的pod并运行pod install
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'RCTPushNotification',
]
Run Code Online (Sandbox Code Playgroud)
由于上面没有提到的对我有用,所以我开始尝试,这就是为我解决的问题:
正如Escamilla所提到的,在xcode中打开RCTPushNotification.xcodeproj和在Build Settings搜索下header search path并在其中添加2路径:
"$(SRCROOT)/../../../../ios/Pods/Headers/Public""$(SRCROOT)/../../../../ios/Pods/Headers/Public/React-Core"RCTPushNotificationManager.h手动复制到React-Core在项目的根文件夹中执行:
cp ./node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h ./ios/Pods/Headers/Public/React-Core/React
Run Code Online (Sandbox Code Playgroud)
这将复制RCTPushNotificationManager.h至极是node_modules/react-native/Libraries/PushNotificationIOS/手动进React这是在文件夹中ios/Pods/Headers/Public/React-Core/React。
我不知道这是否是一个很好的解决方案,但是可以。也许有人可以向我解释为什么它最初不在那儿?那将是黄金。
我非常仔细地按照设置说明进行了1到1的正确操作,但除上述手动副本外,其他操作均无效。
此外,这会偶尔随机重置,因此必须再次执行-.-'
| 归档时间: |
|
| 查看次数: |
11885 次 |
| 最近记录: |