开发者

EXC_BAD using own struct as return value

开发者 https://www.devze.com 2023-03-26 13:13 出处:网络
i am using the following struct as a return value of a method: typedef开发者_如何学C struct { CLLocationCoordinate2D topLeftCorner;

i am using the following struct as a return value of a method:

typedef开发者_如何学C struct {
CLLocationCoordinate2D topLeftCorner;
CLLocationCoordinate2D bottomRightCorner;
} LCMapBoundings;

The following method crashes instantly:

-(LCMapBoundings)calculate {
NSLog(@"test");
}

But that one works:

-(LCMapBoundings*)calculate {
NSLog(@"test");
}

Why is that? What am i messing up when using the first method?


Perhaps it's crashing because you don't return a value in your method? That's undefined behaviour.

0

精彩评论

暂无评论...
验证码 换一张
取 消