Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 未定义的声明错误_Ios_Objective C - Fatal编程技术网

Ios 未定义的声明错误

Ios 未定义的声明错误,ios,objective-c,Ios,Objective C,我正在尝试开发一个iPhone应用程序,它给出当前的纬度和经度值,但出现了一个名为“Undefined declaration”的错误。你能帮我整理一下吗。提前谢谢 #import "LoginViewController.h" //#import <CoreLocation/CoreLocation.h> @interface LoginViewController () @end @implementation LoginViewController @synthesize

我正在尝试开发一个iPhone应用程序,它给出当前的纬度和经度值,但出现了一个名为“Undefined declaration”的错误。你能帮我整理一下吗。提前谢谢

#import "LoginViewController.h"
//#import <CoreLocation/CoreLocation.h>

@interface LoginViewController ()

@end

@implementation LoginViewController
@synthesize locationManager;
- (void)dealloc
{
   // [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Do any additional setup after loading the view, typically from a nib.
}

- (IBAction)Button:(id)sender
{
    locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
    locationManager.distanceFilter = kCLDistanceFilterNone;
    [locationManager startUpdatingLocation];
    CLLocation *location = [locationManager location];
    CLLocationCoordinate2D coordinate = [location coordinate];
    NSString *latitude = [NSString stringWithFormat:@"%f", coordinate.latitude];
    NSString *longitude = [NSString stringWithFormat:@"%f", coordinate.longitude];
    NSLog(@"dLatitude : %@", latitude);
    NSLog(@"dLongitude : %@", longitude);
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(50, 40, 250, 50)];
    UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, 80, 200, 50)];
    UILabel *myLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(50, 120, 200, 100)];
    myLabel.textColor = [UIColor blackColor];
    myLabel1.textColor = [UIColor blackColor];

    label.backgroundColor = [UIColor clearColor];
    myLabel.backgroundColor = [UIColor clearColor];
    myLabel1.backgroundColor = [UIColor clearColor];
    [myLabel setText:latitude];
    [myLabel1 setText:longitude];
    label.text = @"Current Latitude and Longitude";
    [self.view addSubview:label];
    [self.view addSubview:myLabel];
    [self.view addSubview:myLabel1];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait); <---GETTING ERROR HERE

}

@end
#导入“LoginViewController.h”
//#进口
@接口LoginViewController()
@结束
@实现LoginViewController
@综合定位经理;
-(无效)解除锁定
{
//[super dealoc];
}
-(无效)未收到记忆警告
{
[超级记忆警告];
//处置所有可以重新创建的资源。
}
-(无效)视图卸载
{
[超级视频下载];
//加载视图后,通常从nib执行任何其他设置。
}
-(iAction)按钮:(id)发送者
{
locationManager=[[CLLocationManager alloc]init];
locationManager.delegate=self;
locationManager.desiredAccuracy=KCallocationAccuracyHundredMeters;
locationManager.distanceFilter=KCLDistanceFilterOne;
[locationManager startUpdatingLocation];
CLLocation*location=[locationManager位置];
CLLocationCoordinate2D坐标=[位置坐标];
NSString*纬度=[NSString stringWithFormat:@“%f”,坐标.纬度];
NSString*经度=[NSString stringWithFormat:@“%f”,坐标.经度];
NSLog(@“纬度:%@”,纬度);
NSLog(@“长度:%@”,经度);
UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(50,40,250,50)];
UILabel*myLabel=[[UILabel alloc]initWithFrame:CGRectMake(50,80,200,50)];
UILabel*myLabel1=[[UILabel alloc]initWithFrame:CGRectMake(50120200100)];
myLabel.textColor=[UIColor blackColor];
myLabel1.textColor=[UIColor blackColor];
label.backgroundColor=[UIColor clearColor];
myLabel.backgroundColor=[UIColor clearColor];
myLabel1.backgroundColor=[UIColor clearColor];
[myLabel setText:纬度];
[myLabel1 setText:经度];
label.text=@“当前纬度和经度”;
[self.view addSubview:label];
[self.view addSubview:myLabel];
[self.view addSubview:myLabel1];
}
-(布尔)应将自动旋转指针面方向:(UIInterfaceOrientation)转换为接口方向
{
return(interfaceOrientation==UIInterfaceOrientationPortrait);应该是

return (toInterfaceOrientation == UIInterfaceOrientationPortrait); 

你知道是哪一行产生了这个错误吗?这是最后一个返回语句,上面写着未声明的标识符“interfaceOrientation”