我正在开发一个react本机应用程序(分离的),并试图安装OneSignal以进行推送通知,它在安卓系统上运行得非常好,但我在ios上遇到了问题。
最初,我得到了一个错误:未找到'React/RCTAnimationType.h'文件。然后在搜索错误后,我发现我需要将OneSignal指定到pod文件中(OneSignal文档没有提到这一点,或者我错过了它)。
在我将以下内容添加到pod文件之后:
pod 'react-native-onesignal',
:path => '../node_modules/react-native-onesignal'然后它抱怨豆荚规格什么的,嗯,我也在他们的GitHub OneSignal回购上找到了这个文件。
所以我改变了如下:
pod 'react-native-onesignal',
:podspec => "../node_modules/react-native-onesignal/react-native-onesignal.podspec",
:path => '../node_modules/react-native-onesignal'运行命令pod install
看起来它解决了一些问题,但是我得到了另一个错误,如下所示:
好了!安装错误-本机-一个信号!/usr/local/bin/git克隆/var/folders/hp/96xj1gkj76s_x7hbh3rd2vs80000gn/T/d20180504-46105-1fdo6c6 git+https://github.com/geektimecoil/react-native-onesignal.git.git -模板=-单分支-深度1-分支v3.1.4 克隆入'/var/folders/hp/96xj1gkj76s_x7hbh3rd2vs80000gn/T/d20180504-46105-1fdo6c6'...致命:找不到“git+https”的远程助手
我的最后一个podfile如下:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'my app' do
pod 'ExpoKit',
:git => "http://github.com/expo/expo.git",
:tag => "ios/2.4.4",
:subspecs => [
"Core",
"CPP",
"GL"
]
pod 'React',
:path => "../node_modules/react-native",
:inhibit_warnings => true,
:subspecs => [
"Core",
"ART",
"RCTActionSheet",
"RCTAnimation",
"RCTCameraRoll",
"RCTGeolocation",
"RCTImage",
"RCTNetwork",
"RCTText",
"RCTVibration",
"RCTWebSocket",
"DevSupport",
"CxxBridge"
]
pod 'yoga',
:path => "../node_modules/react-native/ReactCommon/yoga",
:inhibit_warnings => true
pod 'DoubleConversion',
:podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec",
:inhibit_warnings => true
pod 'Folly',
:podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec",
:inhibit_warnings => true
pod 'glog',
:podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec",
:inhibit_warnings => true
pod 'react-native-onesignal',
:podspec => "../node_modules/react-native-onesignal/react-native-onesignal.podspec",
:path => '../node_modules/react-native-onesignal'
post_install do |installer|
installer.pods_project.main_group.tab_width = '2';
installer.pods_project.main_group.indent_width = '2';
installer.pod_targets.each do |target|
if target.pod_name == 'ExpoKit'
target.native_target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'
# needed for GoogleMaps 2.x
config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= []
config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Base/Frameworks'
config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Maps/Frameworks'
end
end
if ['Amplitude-iOS','Analytics','AppAuth','Branch','CocoaLumberjack','FBSDKCoreKit','FBSDKLoginKit','FBSDKShareKit','GPUImage','JKBigInteger2'].include? target.pod_name
target.native_target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
# Build React Native with RCT_DEV enabled
next unless target.pod_name == 'React'
target.native_target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_DEV=1'
end
end
end
end我只是觉得我做了太多需要做的事情,谁能让我知道我在这里做错了什么吗?
忘了提到,在做任何事情之前,我都使用react本机链接react本机-一个用于安卓和iOS的信号链接了这个库。
发布于 2018-05-04 13:07:50
我在我的一个项目中实现了一个信号,它运行得非常好,我没有安装豆荚,我用这个博客帮助实现了,它在android和ios中都很好。
希望这能帮到你,如果你需要帮助,就问我吧。
https://stackoverflow.com/questions/50170693
复制相似问题