2014-07-07 22 views
1

我是艾哈邁德。我一直試圖解決一個問題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 

回答

2

根據MacTracker,你的MacBook Pro的不兼容。

蘋果把低功耗藍牙芯片的MacBook Pro的開始與2012年年

由於iBeacon顯示在現實BLE(這是隱藏的,至少在iOS的一部分:CLBeacon VS CoreBluetooth)的使用,你除非您可能有特殊的BLE芯片(外部,我們可以在市場上找到一些USB),否則您的MBP不會檢測到iBeacon。

要驗證您的筆記本電腦是否兼容BLE,建議您在SuperUser上閱讀this

+0

你是對的,非常感謝你:)我有紅色的文章,它是說,2011年底mac支持。 現在我確定它沒有。 謝謝。 –

+0

2011年,獲得該BLE芯片的是MBA。如果anwser是正確的,你能驗證它嗎? – Larme