Tag: Ç

本地通知何时didEnterRegion?

我有以下代码,当应用程序终止工作完美。 -(void)beaconManager:(id)manager didEnterRegion:(CLBeaconRegion *)region{ UILocalNotification *notification = [UILocalNotification new]; notification.alertBody = @"TEST NOTIFICATION"; notification.soundName = UILocalNotificationDefaultSoundName; [[UIApplication sharedApplication] presentLocalNotificationNow:notification]; } 但是,当我做到以下几点: -(void) createTestNotification { UILocalNotification *notification = [UILocalNotification new]; notification.alertBody = @"TEST"; notification.soundName = UILocalNotificationDefaultSoundName; [[UIApplication sharedApplication] presentLocalNotificationNow:notification]; } -(void)beaconManager:(id)manager didEnterRegion:(CLBeaconRegion *)region{ [self createTestNotification]; } 这是行不通的 ? 我只把我的代码移到外面没有别的? 我知道,当didEnterRegion被调用时,应用程序将只有5秒,但调用此方法不会花费这个时间? 更新1: 我刚刚发现区域 didEnterRegion返回的是我开始监测,而不是属于应用程序刚才看到它的信标的那个。我打算使用这个区域来获取我的自定义味精取决于该地区的主要和次要 。 但在我的情况下是不可能的,所以我开始测距,当didEnterRegion被调用,然后在didRangeBeacons返回信标数组我得到了属于这个信标的文本信息从本地数据库 “取决于主要和次要的” […]