我创建了一个新的应用程序,我正在尝试使用react-native-firebase.但我不断得到这个错误:
在iOS上本地未找到RNFirebase核心模块,确保您已在项目的"Podfile"中正确包含RNFirebase pod并运行"pod install".
有关ios设置指南,请参见http://invertase.link/ios.
我已经完成的步骤:
yarn add react-native-firebase
react-native link react-native-firebase
pod update确保我使用Ruby 2.5.0后跑了我目前使用的pod文件是:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'MyProject' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
target 'MyProjectTests' do
inherit! :search_paths
# Pods for testing
end
end
Run Code Online (Sandbox Code Playgroud)
这些是我正在使用的版本:
"react": …Run Code Online (Sandbox Code Playgroud) 当我尝试部署我的firebase函数时,我收到一个非常奇怪的错误.
作为排除我的代码的测试,我删除了除require(firebase-functions);我index.js文件中的语句之外的所有内容然后尝试部署,但我再次收到相同的错误消息:
Error: Failed to get status of functions deployments.
Run Code Online (Sandbox Code Playgroud)
它还提示我查看我的功能日志文件,但没有任何新的或相关的输出.任何人都知道如何解决这个问题?
我收到一个错误:
模糊解析:模块".../myModule.js"尝试要求'react-native',但有几个文件提供此模块.您可以删除或修复它们:
.../MyProject的/ IOS /荚/反应,和/的package.json
.../MyProject的/ node_modules /反应原生/的package.json
我几乎可以肯定这是因为使用Podfiles,特别是当他们安装"React"文件夹时.但是,我必须使用Podfiles才能安装react-native-firebase.话虽如此,当我删除我的Pods文件夹下的React文件夹(ios/Pods/React)时,我再也无法使用了react-native-firebase.
GitHub周围有一个修复程序,建议在Podfile中附加:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
Run Code Online (Sandbox Code Playgroud)
但这对我不起作用.以前有人遇到过这个问题吗?
如果它是相关的,这是我正在使用的podfile:
platform :ios, '8.0'
target 'MyProject2' do
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
pod 'RNSVG', :path => '../node_modules/react-native-svg'
target 'MyProject2Tests' do
inherit! :search_paths
# Pods for testing
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
end
Run Code Online (Sandbox Code Playgroud)
编辑:当我从我的Podfile中删除'RNSVG'时,我收到一条错误消息:"不变违规:'RNSVGPath'的原生组件不存在".我已经运行react-native链接并按照手动安装的说明进行操作react-native-svg.
我最近paho-mqtt通过yarn下载了。问题是我不确定我是否正确导入它,因为我收到错误:
无法读取未定义的属性“Client”
我导入和使用它的方式是这样的:
import Paho from 'paho-mqtt';
var client = new Paho.MQTT.Client(location.host, location.port, location.clientID)
const MQTTConnectAndMessage = (message) => {
client.connect({onSuccess: sendMQTTMessage})
}
const sendMQTTMessage = (msg) => {
let message = new Paho.MQTT.Message(msg);
message.destinationName = location.messageDestination;
client.send(message);
}
Run Code Online (Sandbox Code Playgroud)
location.host = IP 字符串
location.port = 端口号
location.clientID = clientID 的字符串
如果相关,我将尝试在 React Native 应用程序中使用它。
也许这个模块不适合通过 NPM 或 Yarn 下载?或者也许我不应该导入“Paho”?
编辑:使用时react-native-paho-mqtt--这是我正在使用的代码:
const client = new Client({ uri: 'ws://myiphere/ws', port: 1883, clientId: 'clientId', storage: myStorage});
const sendMQTTMessage = …Run Code Online (Sandbox Code Playgroud) 我正在使用 python 库requests尝试向本地服务器发送发布请求。我已成功安装并导入了请求 - 我似乎无法从本地服务器发布或获取数据。
服务器和我的python程序都在同一台机器上,该服务器目前是Django的开发服务器。
我正在尝试什么:
domain = 'localhost:8000'
user = 'username'
password = 'password'
data = 'some data to be sent'
r = requests.post(domain, data auth=(user,password))
Run Code Online (Sandbox Code Playgroud)
引发异常:
raise InvalidSchema("No connection adapters were found for '%s'" % url)
requests.exceptions.InvalidSchema: No connection adapters were found for 'localhost:8000'
Run Code Online (Sandbox Code Playgroud)
我已经完成了所有基本的事情,例如确保服务器启动并运行。我还尝试用 127.0.0.1:8000 替换 localhost。
我正在尝试使用该react-native-notifications库,但是当我尝试导入"RNNotifications.h"时,我收到了一个找不到文件的错误.
我按照React Native文档中的"手动链接库"指南进行操作.玩游戏,这就是我做的:
步骤1:
我在Xcode上打开了我的项目,点击了我的项目名称,打开了它的"Libraries"文件夹,然后用来Finder添加"RNNotifications.xcodeproj"(位于我项目node_modules/react-native-notifications/RNNotifications文件夹中的文件).
第2步:
确保我的项目被选中,以我的项目名称为目标,然后在"Link Binary With Libraries"下的"Build Phases"中添加"libRNNotifications.a".
第3步:我进入"Build Settings"并在我的"Header Search Paths"中添加了以下路径:
$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications
我使用"非递归"选项,因为RNNotifications文件夹中没有子文件夹.
第4步:
我进入项目的"AppDelegate.m"并添加了以下import语句:
#import "RNNotifications.h"
完成这四个步骤后,我收到"'RNNotifications.h'文件未找到"错误.
react-native ×4
cocoapods ×2
django ×1
firebase ×1
javascript ×1
mqtt ×1
paho ×1
python ×1
python-3.x ×1
reactjs ×1
xcode ×1