gpt4 book ai didi

ios - [NSString stringWithFormat :] 的崩溃问题

转载 作者:行者123 更新时间:2023-11-28 17:35:32 30 4
gpt4 key购买 nike

我将我的申请提交给苹果审核。苹果拒绝并给了我以下崩溃报告。

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;
}

方法中使用的实用方法如下:

-(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";

}

}

最佳答案

变量 realWorld 在哪里出现?我怀疑这是一个类字段,您分配了调用 dateDescriptionRealWorld 的结果,但从不保留。不过,这只是基于不完整信息的猜测。

关于ios - [NSString stringWithFormat :] 的崩溃问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9888762/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com