我是艾哈邁德。我一直試圖解決一個問題3天,我有第一次與Estimote信號燈溝通。 (我在信標上相當新穎),我閱讀了很多文章並查找了很多示例代碼。甚至嘗試了Estimote示例應用程序(在Estimote SDK文件中提供)。一些如何通過我編寫的代碼和SDK文件中的示例代碼(app)找不到信標。但在應用程序商店的預計應用程序工作正常。Estimote Ibeacon無法用Mac在2011年末發現
我正在使用MacBookPro 2011年末版本。
如果你對我有所幫助,我會很感激。我的目的是先溝通,其餘的都會來。我不能出門,所以我用這種方式編寫了代碼。
這是我正在使用的代碼。
//MainViewController.h
@interface MainViewController : UIViewController<CLLocationManagerDelegate>
@property(nonatomic, strong)CLBeaconRegion *beaconRegion;
@property(nonatomic, strong)CLLocationManager *locationManager;
@end
@implementation MainViewController
(void)viewDidLoad
{
[super viewDidLoad];
self.locationManager = [[CLLocationManager alloc]init];
self.locationManager.delegate = self;
[self initRegion];
[self locationManager:self.locationManager didStartMonitoringForRegion:self.beaconRegion];
}
- (void)locationManager:(CLLocationManager *)manager didStartMonitoringForRegion:(CLRegion *)region {
NSLog(@"did start monitoring");
[self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
}
-(void)initRegion
{
NSLog(@"Init Region");
NSUUID *uuid = [[NSUUID alloc]initWithUUIDString:@"B9407F30-F5F8-466E-AFF9-25556B57FE6D"];
self.beaconRegion = [[CLBeaconRegion alloc]initWithProximityUUID:uuid identifier:@"identifier"] ;
[self.locationManager startMonitoringForRegion:self.beaconRegion];
}
-(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
NSLog(@"Did enter region"); // never called
[self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
}
-(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region
{
NSLog(@"Did exit region"); // never called
[self.locationManager stopRangingBeaconsInRegion:self.beaconRegion];
NSLog(@"NO Beacon Found...");
}
-(void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region
{
NSLog(@"did range Beacons");
CLBeacon *beacon = [[CLBeacon alloc]init];
beacon = [beacons lastObject];
NSLog(@"BEACON FOUND");
NSLog(@"Proximity UUID: %@",beacon.proximityUUID.UUIDString);
NSLog(@"MAJOR ID: %@", beacon.major);
NSLog(@"MINOR ID: %@", beacon.minor);
}
@end
你是對的,非常感謝你:)我有紅色的文章,它是說,2011年底mac支持。 現在我確定它沒有。 謝謝。 –
2011年,獲得該BLE芯片的是MBA。如果anwser是正確的,你能驗證它嗎? – Larme