我正在尝试在用户接受位置共享后显示视图。这是代码:
-(void) locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
if (status == kCLAuthorizationStatusDenied) {
NSLog(@"Denied");
}
else if (status == kCLAuthorizationStatusAuthorized) {
NSLog(@"Accepted!");
AlertViewController *aViewController = [[AlertViewController alloc] initWithNibName:@"AlertViewController" bundle:nil];
aViewController.view.frame = CGRectMake(0, 0, 320, 460);
aViewController.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate.window addSubview:[aViewController view]];
}
}
但是我*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0xee6fc90'
在线上遇到错误aViewController.view.frame = ...
我放了断点并验证了aViewController
它不在语句0x00000
之后。alloc
我似乎无法弄清楚问题是什么。请提出解决方案。