我试图使用一些花哨的iBeacons没有成功,kCLAuthorizationStatusNotDetermined一直.根据其他问题,需要将这些密钥添加到info.plist(一些问题说一个,另一个问题说两者都有).根据iBeacons的一篇文章,我需要Always选项.
<key>NSLocationWhenInUseUsageDescription</key>
<string>Nothing to say</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Permiso para acceder siempre</string>
Run Code Online (Sandbox Code Playgroud)
在viewDidAppear:
self.locManager = [[CLLocationManager alloc]init];
self.locManager.delegate = self;
[self.locManager requestAlwaysAuthorization];
NSUUID* region1UUID = [[NSUUID alloc]initWithUUIDString:@""]; //ibeacon real UUID between "". Checked it's not nil.
self.beaconRegion = [[CLBeaconRegion alloc]
initWithProximityUUID:proximityUUID
identifier:@"myCoolString"];
self.beaconRegion.notifyEntryStateOnDisplay = YES;
self.beaconRegion.notifyOnEntry = YES;
self.beaconRegion.notifyOnExit = NO;
[self.locManager startMonitoringForRegion:self.beaconRegion];
[self.locManager startRangingBeaconsInRegion:self.beaconRegion];
Run Code Online (Sandbox Code Playgroud)
在执行最后两种方法之一之前,图标未出现在"设置/隐私/位置"中.永远不会出现批准权限的警报视图.如果我在"位置设置"中执行手动更改并进行检查,则会更改状态,但过了一会儿,"设置"中的位置将删除我的应用的"始终"状态,并将其再次留空.后来我检查没有运气
-(void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
Run Code Online (Sandbox Code Playgroud)
什么缺失或错误的想法?谢谢
我想做一些图形元素消失,移动背景图像,然后会出现新的图像元素.问题是当背景移动时,在背景移动动画完成之前出现新的背景.我没有在相关问题中看到一个好的答案,所以我会感激任何帮助.伪代码:
-(void)method1 {
[UIView animateWithDuration:0.6
delay:0.0 options:UIViewAnimationOptionCurveEaseIn
animations:^{
self.setThisOne.hidden = YES;
self.setThisAnother.hidden = YES;
}completion:^(BOOL finished) {
[UIView animateWithDuration:0.6
delay:0.3
options: UIViewAnimationOptionCurveEaseIn
animations:^{ self.background.frame = myFrame; //Move background image
} completion:^(BOOL finished){
if (finished) {
[self method2];
}
}
];
}];
Run Code Online (Sandbox Code Playgroud)
}
-(void)method2 {
[UIView animateWithDuration:0.2
delay:0.3
options: UIViewAnimationOptionBeginFromCurrentState
animations:^{
self.aButtonsAppear.hidden = NO;
self.moreElementsApeear.hidden = NO
} completion:nil];
Run Code Online (Sandbox Code Playgroud)
}