风量计没有连接

时间:2015-11-04 10:06:39

标签: ios objective-c ios9

我正在使用WindMeterSDKhttps://github.com/WeatherFlow/WindMeterSDK)将风力计集成到我自己的应用程序中,但我的风速计没有连接到应用程序。

我正在使用此sdk的演示代码

sensor = [[WindMeterSDK alloc] init];

    [sensor reportValueChange:^(AnemometerObservation *value){

        self.latestObservation = value;
        if ([self.latestObservation.statusCode intValue] == OK) {
            dispatch_sync(dispatch_get_main_queue(), ^{
                console.text = [[NSString stringWithFormat:@"%@ (%@):  %f mps @ %f° (%f, %f)\n", self.latestObservation.timestamp, self.latestObservation.timezone, [self.latestObservation.windSpeed floatValue], [self.latestObservation.windDirectionDegreesTrue floatValue], [[value.deviceLocation objectForKey:@"latitude"] floatValue], [[self.latestObservation.deviceLocation objectForKey:@"longitude"] floatValue]] stringByAppendingString:console.text];
                NSLog(@"%@",[self.latestObservation prettyJsonString]);
            });
        } else if ([self.latestObservation.statusCode intValue] == ANEMOMTER_NOT_CONNECTED) {
            console.text = [@"DEVICE NOT CONNECTED!\n" stringByAppendingString:console.text];
            NSLog(@"DEVICE NOT CONNECTED!");
        }
    }];

1 个答案:

答案 0 :(得分:0)

这可能看起来很傻但你导入了文件

import" WindMeterSDK.h"

在您的控制器中。

这一步非常重要 确保已设置以下链接器标志:" -ObjC"," -all_load"和" -lc ++" 检查构建设置中的链接器搜索路径