App Developer
App Developer

Reputation: 421

Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN

When I'm clicking button I'm getting this exception.I don't know where I'm doing wrong Someone help me .my app is rejected because of this exception my code:

 UILabel *rememberMeLabelObj = [[UILabel  alloc]initWithFrame:CGRectMake(xaxisForRememberMeLabel, yaxisForRememberMeLabel, widthForRememberMeLabel, heightForRememberMeLabel)];
rememberMeLabelObj.text = @"Remember me";
rememberMeLabelObj.font =[UIFont systemFontOfSize:14.0];

rememberMeLabelObj.textColor = [UIColor colorWithRed:0.816f green:0.592f  blue:0.157f alpha:1.00f];
[self.view addSubview:rememberMeLabelObj];

Upvotes: 9

Views: 11909

Answers (4)

Khushtar Parvez
Khushtar Parvez

Reputation: 71

I check this issue here and there but didn’t got the answer but when i checked all case below I got the answer :-

  1. This is also possible due to if you placed latitude in the place of longitude and longitude in the place of latitude // please make sure that

  2. Please also check your API response data is correct and in right place

Upvotes: 0

Ouyang Yong
Ouyang Yong

Reputation: 71

My iOS App has the same problem when the simulator version is 8.x, it is no problem in version 9.x,after I have checked and removed the following code, the problem is solved!

- (void)viewWillAppear:(BOOL)animated
 {
  [LoadTableView setContentOffset:CGPointMake(CGFLOAT_MAX, CGFLOAT_MAX)];

  [super viewWillAppear:YES];

 }


 - (void)viewDidAppear:(BOOL)animated
 {
   [LoadTableView reloadData];

   LoadTableView.hidden = 0;

   [super viewDidAppear:YES];


 }

Upvotes: 1

App Developer
App Developer

Reputation: 421

I solved my issue actually I didn't gave float values because of this I got exception.I gave CGFloat and gave values as integer like 400,350,etc but I need give 400.0f .so,I got this issue .Now it was cleared

Upvotes: 4

Naeem
Naeem

Reputation: 789

You are calling UILabel frame methods, and probably calculating the value somehow and the result is a NaN, which means "not a number" and, as you correctly suggested, it can be the result of o divide-by-zero operation.

But it can appear for a lot other reasons: http://en.wikipedia.org/wiki/NaN

Reference: kuba

Upvotes: 4

Related Questions