私のアプリケーションをアップルのためにアップルに提出しました.Appleが拒否され、次のクラッシュレポートが届きました。[NSString stringWithFormat:]のクラッシュの問題
Thread 0 Crashed:
1 Foundation 0x3595dd04 _NSDescriptionWithLocaleFunc + 44
2 CoreFoundation 0x36ae696e __CFStringAppendFormatCore + 7998
3 CoreFoundation 0x36a611d8 _CFStringCreateWithFormatAndArgumentsAux + 68
4 Foundation 0x3595dc2e +[NSString stringWithFormat:] + 54
5 WIPTime 0x0001572e -[NSDate(TKCategory) reportHeader] + 66
6 WIPTime 0x0006bd9e -[ReportDelegate tableView:cellForRowAtIndexPath:] + 474
7 UIKit 0x36de009c -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 540
8 UIKit 0x36ddf17a -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1070
9 UIKit 0x36dde904 -[UITableView layoutSubviews] + 200
10 UIKit 0x36d830d8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 176
11 CoreFoundation 0x36a651f4 -[NSObject performSelector:withObject:] + 36
12 QuartzCore 0x36241a9e -[CALayer layoutSublayers] + 210
13 QuartzCore 0x362416b6 CA::Layer::layout_if_needed(CA::Transaction*) + 210
14 QuartzCore 0x3624583c CA::Context::commit_transaction(CA::Transaction*) + 220
15 QuartzCore 0x36245578 CA::Transaction::commit() + 308
16 QuartzCore 0x3623d4b2 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 50
17 CoreFoundation 0x36adab14 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 12
18 CoreFoundation 0x36ad8d50 __CFRunLoopDoObservers + 252
19 CoreFoundation 0x36ad90aa __CFRunLoopRun + 754
20 CoreFoundation 0x36a5c49e CFRunLoopRunSpecific + 294
21 CoreFoundation 0x36a5c366 CFRunLoopRunInMode + 98
22 GraphicsServices 0x30b3e432 GSEventRunModal + 130
23 UIKit 0x36dade76 UIApplicationMain + 1074
24 WIPTime 0x00003032 main + 42
25 WIPTime 0x00002ffc start + 32
reportHeaderための実装は以下の通りです:メソッド内で使用されている
-(NSString *) reportHeader
{
NSString *realWorld=[self dateDescriptionRealWorld];
NSString *year=[self yearString];
NSString *weekDay=[self weekdayString];
NSString *returnString=[NSString stringWithFormat:@"%@ %@ %@",weekDay,realWorld,year];
return returnString;
}
ユーティリティメソッドを以下の通りです:
変数realWorld
は、画像に入って来るん
-(NSString *) dateDescriptionRealWorld
{
return [NSString stringWithFormat:@"%@ %@",[self dayString],[self monthStringWithCod]];
}
- (NSString*) monthString{
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"MMMM"];
return [dateFormatter stringFromDate:self];
}
- (NSString*) yearString{
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"yyyy"];
return [dateFormatter stringFromDate:self];
}
- (NSString*) dayString{
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"dd"];
return [dateFormatter stringFromDate:self];
}
- (int) weekday{
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *comps = [gregorian components:(NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit | NSWeekdayCalendarUnit) fromDate:self];
int weekday = [comps weekday];
[gregorian release];
return weekday;
}
-(NSString *) weekdayString
{
NSDate *date=self;
int weekday=[date weekday];
if (weekday ==0) {
return @"Sat";
}
else if(weekday ==1)
{
return @"Sun";
}
else if(weekday ==2)
{
return @"Mon";
}
else if(weekday ==3)
{
return @"Tue";
}
else if(weekday ==4)
{
return @"Wed";
}
else if(weekday ==5)
{
return @"Thu";
}
else if(weekday ==5)
{
return @"Fri";
}
}
これはクラッシュであり、リークではありません。 –
'monthStringWithCod'が存在します。 – Ilanchezhian
はいそれはコードの別のメソッドを呼び出します。私は即座にコードを投稿します –