相关疑难解决方法(0)

要求用户权限在iOS 8中接收UILocalNotifications

我在App Delegate中设置了本地通知使用此方法:

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    UILocalNotification *notification = [[UILocalNotification alloc]init];
    [notification setAlertBody:@"Watch the Latest Episode of CCA-TV"];
    [notification setFireDate:[NSDate dateWithTimeIntervalSinceNow:5]];
    [notification setTimeZone:[NSTimeZone defaultTimeZone]];
    [application setScheduledLocalNotifications:[NSArray arrayWithObject:notification]];
}
Run Code Online (Sandbox Code Playgroud)

当我运行应用程序然后退出它时,我收到一条错误消息:

2014-06-07 11:14:16.663 CCA-TV [735:149070] 试图安排本地通知 {开火日期= 2014年6月7日星期六太平洋夏令时间11:14:21,时区= America/Los_Angeles (PDT)偏移-25200(日光),重复间隔= 0,重复计数= UILocalNotificationInfiniteRepeatCount,下一个开火日期= 2014年6月7日星期六太平洋夏令时间11:14:21,用户信息=(null)} 带警报但尚未收到用户显示警报的许可

如何获得显示警报的必要权限?

notifications cocoa-touch ios uilocalnotification ios8

115
推荐指数
4
解决办法
6万
查看次数

locationManager:didRangeBeacons方法未检测到BLE设备

我正在使用Nordic BLE nRF8001开发套件来测试CoreBluetooth.使用CBCentralManager的方法(例如didDiscoverPeripheral(),didConnectPeripheral()等),我的iPhone 5能够检测到北欧设备的广告并连接到它就好了.但是,我没有收到新的locationManager range或regionMonitoring方法的任何响应.下面我将解释我的设置:

1.)首先,我使用传入的外围设备(我的Nordic设备)在didDiscoverPeripheral()委托方法中从我的Nordic设备检索我的NSUUID.我为我的Nordic设备创建了一个自定义服务,所以假设这个外围设备是Nordic设备.要检索我使用的NSUUID:

    NSUUID *uuid = [peripheral identifier];  
    NSString *uuidString = [uuid UUIDString]; //uuidString = 9A8D4C73-152D-BBDA-E4C2-9CE952654645
Run Code Online (Sandbox Code Playgroud)

2.)接下来,我为我的Nordic设备创建一个信标区域并创建一个CLLocationManager:

    self.locationManagerBeacon = [[CLLocationManager alloc] init];
    [self.locationManagerBeacon setDelegate:self];
    NSUUID *myUUID = [[NSUUID alloc] initWithUUIDString:@"9A8D4C73-152D-BBDA-E4C2-9CE952654645"];
    self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:myUUID
                                                      identifier:@"nordicRegion"];
    self.beaconRegion.notifyEntryStateOnDisplay = YES;
Run Code Online (Sandbox Code Playgroud)

3.)现在我开始监控信标区域

[self.locationManagerBeacon startRangingBeaconsInRegion:self.beaconRegion];
Run Code Online (Sandbox Code Playgroud)

4.)问题:locationManager:didRangeBeacons:调用inRegion,但信标区域始终为空.

问题:Nordic BLE设备是否需要以某种方式配置,以便新的locationManager信标方法能够检测到它(例如BLE广告频率,功率电平等)?如果是这样,有人可以指向我的文档.

感谢帮助!

iphone bluetooth ios ibeacon

2
推荐指数
1
解决办法
3662
查看次数