我正在使用自定义BeaconManager委托,因此信标范围不是由视图控制器的生命周期决定的.一切都很好但每隔一段时间(1-2天)的灯塔范围就会停止工作,并且不会被称为执行范围.解决这个问题的唯一方法是让我重置我的iPhone,一旦我这样做,它就完美无缺.下面是我正在使用的代码.基本流程是,当我的ViewController调用ViewDidLoad时,它会向AppDelegate发送一个通知,告诉它开始为信标设置范围,我从不告诉它停止,因为我希望它继续为信标范围而不管用户导航的位置在应用程序中.我想知道我的代码是否导致了这个问题,或者这只是蓝牙的一个错误.谢谢你的帮助!
BeaconManager.m
#import "BeaconManager.h"
#import "AppDelegate.h"
@interface BeaconManager()<CLLocationManagerDelegate>
@property (nonatomic, strong) CLLocationManager *locationManager;
@property (nonatomic, strong) CLBeaconRegion *beaconRegion;
@end
@implementation BeaconManager
+ (id)sharedManager
{
static BeaconManager *sharedBeaconManager = nil;
static dispatch_once_t once;
dispatch_once(&once, ^{
sharedBeaconManager = [[self alloc] init];
});
return sharedBeaconManager;
}
- (id)init
{
self = [super init];
if(self)
{
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
}
return self;
}
- (void)startBeaconMonitoring:(NSString*)forUUID
{
NSUUID * uuid = [[NSUUID alloc] initWithUUIDString:forUUID];
self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"com.beacons.publicRegion"]; …Run Code Online (Sandbox Code Playgroud) 我需要在iOS 7.0.3模拟器上进行一些测试,但是当我转到Xcode(6.0.1)中的首选项>下载时,组件部分下没有iOS 7.0模拟器.
可能是因为我在运行约塞米蒂?我听说Mavericks机器失去了对iOS 6.0的支持,但是对Yosemite是否已经取消对7.0模拟器的支持无法找到任何明确的答案.