开发者

What's wrong here? (EXC_BAD_ACCESS)

开发者 https://www.devze.com 2023-02-05 16:34 出处:网络
My app crashes during when it tries to round some numbers down. What could be the problem? The debugger shows the first line causes EXC_BAD_ACCESS.

My app crashes during when it tries to round some numbers down. What could be the problem? The debugger shows the first line causes EXC_BAD_ACCESS.

- (NSInteger) hebrewCalanderEndDay:(NSInt开发者_StackOverfloweger)year{

NSInteger monthsElapsed = [[NSNumber numberWithLongLong:floor((235*year-234)/19.0)]integerValue];
NSInteger partsElapsed = 12084 + 13753*monthsElapsed;
NSInteger day = 29*monthsElapsed + [[NSNumber numberWithLongLong:floor(partsElapsed/25920)] integerValue];

if(((3 * (day+1))%7 <3){
  day++;
} 
return day;
}


Well, the first thing I see is a type mismatch between floor() and +numberWithLongLong:. Didn't the compiler complain about that?

Are you trying to implement the Hebrew calendar yourself? I thought that CFLocale already supported it.

0

精彩评论

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