未知类型名称 'ESTBeaconRegion';你是说 'CLBeaconRegion' 吗?

Unknown type name 'ESTBeaconRegion'; did you mean 'CLBeaconRegion'?

问题 1:

我正在关注 this estimote tutorial 创建我自己的 Estimote 应用程序。然而出现了这个错误:

Unknown type name 'ESTBeaconRegion'; did you mean 'CLBeaconRegion'?

如何解决?

我包括了 header 和代表

#import <EstimoteSDK/EstimoteSDK.h>

@interface AppDelegate () <UIApplicationDelegate,CLLocationManagerDelegate,ESTBeaconManagerDelegate>

这是我的 podFile

# Uncomment this line to define a global platform for your project
platform :ios, '7.0'

target 'Tabster' do
pod 'EstimoteSDK', '3.1.0'
end

问题 2: 为什么框架以红色突出显示?

更新:(尝试 Juan Gonzalez 建议的示例应用程序)

我在使用 Estimote SDK 库时遇到了同样的问题。出于未知原因,如果您尝试将 SDK 库包含在新的 Xcode 项目中,它似乎不会加载它。即使您使用 CoreLocation 和 CoreBluetooth headers.

我建议你使用示例代码,以便有一个包含库的项目,然后开始修改它。

here 下载代码,不要尝试从 pod 文件导出它,而不是直接使用从 iOS-SDK zip 文件导出的示例 xcode 项目下载。是否遇到相同问题,请尝试一次。

来自 heypiotr,"In SDK 3.0 we switched from ESTBeaconRegion to CLBeaconRegion, this tutorial you're doing wasn't yet updated to reflect that. It's easy though: just change all your ESTBeaconRegion occurrences to CLBeaconRegion. And while you're at it, we also changed ESTBeacon to CLBeacon, so you may want to replace these as well." 这说明了一切。谢谢大家!

如果你想在新的 estimote SDK 3.0 中使用 "old app",我建议你去阅读这个地址的迁移指南:

https://github.com/Estimote/iOS-SDK/blob/master/SDK_3_0_MIGRATION_GUIDE.md

ESTBeaconManager

ESTBeaconManager class 保留,但功能有所缩减。在目前的形式中,它负责测距和监控 iBeacon 设备以及作为 iBeacon 的广告。它主要涵盖 CoreLocation 功能,但有一些有用的帮助程序,包括 preventUnknownUpdateCount、avoidUnknownStateBeacons 和 returnAllRangedBeaconsAtOnce(在以前的 Estimote SDK 版本中已经可用)。

委托方法适用于 CLBeacon 对象(而不是 ESTBeacon)和 CLBeaconRegion(而不是 ESTBeaconRegion)。让我们以测距委托为例:

SDK 2.4 语法:

- (void)beaconManager:(ESTBeaconManager *)manager
      didRangeBeacons:(NSArray *)beacons
             inRegion:(ESTBeaconRegion *)region
{
    if (beacons.count > 0)
    {
        ESTBeacon *firstBeacon = [beacons objectAtIndex:0];
    }
}

SDK 3.0 语法:

- (void)beaconManager:(id)manager
      didRangeBeacons:(NSArray *)beacons
             inRegion:(CLBeaconRegion *)region
{
    if (beacons.count > 0)
    {
        CLBeacon *firstBeacon = [beacons objectAtIndex:0];
    }
}

希望对你有所帮助。