Closed abmgames closed 9 years ago
Hey, you're welcome! Glad you like it. Let's see if we can sort this out.
I have two thoughts on this:
1.Parasha is different in Israel and outside of Israel during some seasons of some years. Are you using the diaspora method or the Israel one?
I have a few ideas about where this might be coming from, but code and a crash log would be helpful. Regardless, I'll take a look.
Hi Great to hear from you so fast :-) I checked the location of the user , if outside Israel i'm using diaspora otherwise i'm using the Israel one. I manage to handle the crash and fix it till 2017 (but its temporary till we found the problem) The crash came from this method:
The problem is that the weeks jump foreword and go out of the parshiot nsarray range NSArray *parshiot = [self _parshiotForYearType:type inDiaspora:isInDiaspora];
/////------This what i write (quickly) to manage the bug till 2017
//HOT FIX TILL JONE 2017
- (KCParasha *)_parashaForDate:(NSDate *)date inDiaspora:(BOOL)isInDiaspora
{
date = [[self hebrewCalendar] lastDayOfTheWeekUsingReferenceDate:date];
NSInteger year = [[self hebrewCalendar] yearsInDate:date];
NSDate *roshHashana = [NSDate dateWithDay:1 Month:1 Year:year andCalendar:[self hebrewCalendar]];
NSInteger weeksSinceRoshHashana = [[self hebrewCalendar] weeksFromDate:roshHashana toDate:date];
kHebrewYearType type = [NSCalendar typeOfHebrewYearContainingDate:date];
//
// Query the parshios
//
NSArray *parshiot = [self _parshiotForYearType:type inDiaspora:isInDiaspora];
//
// Then look up this weeks parsha
//
//HOT FIX TILL JONE 2017
BOOL isleap = NO;
switch (type) {
case kHebrewYearTypeH:
case kHebrewYearTypeI:
case kHebrewYearTypeJ:
case kHebrewYearTypeK:
case kHebrewYearTypeL:
case kHebrewYearTypeM:
case kHebrewYearTypeN:
isleap = YES;
break;
}
if (!isleap) {
weeksSinceRoshHashana = weeksSinceRoshHashana > 39 ? weeksSinceRoshHashana - 1 : weeksSinceRoshHashana;
}
if (weeksSinceRoshHashana < [parshiot count]) {
NSNumber *parashaIDNumber = parshiot[weeksSinceRoshHashana];
enum KCParashaIdentifier parashaID = [parashaIDNumber integerValue];
KCParasha *parasha = [KCParasha parashaWithIdentifier:parashaID];
return parasha;
}
return nil;
}
Hope it will help you to figure out out go wrong Thanks alot
Which parts of the method did you change? Also, can you please post a screenshot of the console when it crashes?
I change only this part //HOT FIX TILL JONE 2017 BOOL isleap = NO;
switch (type) {
case kHebrewYearTypeH:
case kHebrewYearTypeI:
case kHebrewYearTypeJ:
case kHebrewYearTypeK:
case kHebrewYearTypeL:
case kHebrewYearTypeM:
case kHebrewYearTypeN:
isleap = YES;
break;
}
if (!isleap) {
weeksSinceRoshHashana = weeksSinceRoshHashana > 39 ? weeksSinceRoshHashana - 1 : weeksSinceRoshHashana;
}
if (weeksSinceRoshHashana < [parshiot count]) {
NSNumber *parashaIDNumber = parshiot[weeksSinceRoshHashana];
enum KCParashaIdentifier parashaID = [parashaIDNumber integerValue];
KCParasha *parasha = [KCParasha parashaWithIdentifier:parashaID];
return parasha;
}
return nil;
This line make the crash NSNumber *parashaIDNumber = parshiot[weeksSinceRoshHashana]; weeksSinceRoshHashana going out of array bounds in the end of the year
KCParashatHashavuaCalculator bug is fixed? :)
thanks
Unfortunately, not yet. I'm interning at a company this summer, and I'm not working on third party code during that time, for copyright/intellectual property reasons.
If someone wants to look at the code and attempt a fix, I'll look at it - can't guarantee that I'll be able to accept a pull request.
My internship is over at the end of August.
Moshe wish pass successfully. Get a good job and learn a lot of Torah!
@abmgames Does PR #10 (36c66eb4a804e28a52d142932b1f0b4b31e7db32) fix the problem?
That fixed it for me. Thanks!
Looks like that was the issue. Closing.
Hi first of all thanks for the amazing library There is a bug in KCParashatHashavuaCalculator The Parash jump one week forward from 4/07/2015 and crash on 12/09/2015
Thanks alot