使用野狗(Wilddog)云setValue写入数据

Posted death3721

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用野狗(Wilddog)云setValue写入数据相关的知识,希望对你有一定的参考价值。

- (void)viewDidLoad {
    [super viewDidLoad];
    //创建野狗实例化对象 用于随时监听数值变化
    Wilddog *myRootRef = [[Wilddog alloc] initWithUrl:@"https://exile.wilddogio.com/weather"];
    //监听键值
    [myRootRef observeEventType:WEventTypeValue withBlock:^(WDataSnapshot *snapshot) {
        NSLog(@"%@ -> %@", snapshot.key, snapshot.value);
    }];
    //为weather键赋初始值
    [myRootRef setValue:@"Sunny"];
    
    UIButton* btn1=[[UIButton alloc]initWithFrame:CGRectMake(20, 20, 100, 30)];
    btn1.backgroundColor=[UIColor orangeColor];
    [btn1 addTarget:self action:@selector(changeValue1) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn1];
    
    UIButton* btn2=[[UIButton alloc]initWithFrame:CGRectMake(20, 70, 100, 30)];
    btn2.backgroundColor=[UIColor orangeColor];
    [btn2 addTarget:self action:@selector(changeValue2) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn2];
}

-(void)changeValue1
{
    Wilddog *myRootRef = [[Wilddog alloc] initWithUrl:@"https://exile.wilddogio.com/weather"];
    [myRootRef setValue:@"Snow"];
}

-(void)changeValue2
{
    Wilddog *myRootRef = [[Wilddog alloc] initWithUrl:@"https://exile.wilddogio.com/weather"];
    [myRootRef setValue:@"Wind"];
}

 

以上是关于使用野狗(Wilddog)云setValue写入数据的主要内容,如果未能解决你的问题,请参考以下文章

程序员客栈携手野狗 体验国内领先的实时后端云协作

Firebase 实时数据库 setValue() 不工作

wilddog & arcgisAPI & vue-cli插件,天坑之路

C#类属性的动态读取写入--SetValue--GetValue

在 Dataflow 中从 BigQuery 写入云存储时如何设置文件大小而不是分片数

QSettings setvalue 方法将 QVariant 数据类型写入 Windows 注册表