我在将IOS6的代码升级至IOS16的过程中,代码中出现莫名错误,不知道如何去解决:
-(instancetype)init
{
if ( (self = [super init]) ) {
self.graphClass = [CPTXYGraph class];
}
return self;
}
/// @}
-(id)newGraph
{
CPTXYGraph *graph;
if ( self.graphClass ) {
graph = [[self.graphClass alloc] initWithFrame:CPTRectMake(0.0, 0.0, 200.0, 200.0)];
}
else {
graph = [[CPTXYGraph alloc] initWithFrame:CPTRectMake(0.0, 0.0, 200.0, 200.0)];
}
graph.paddingLeft = CPTFloat(60.0);
graph.paddingTop = CPTFloat(60.0);
graph.paddingRight = CPTFloat(60.0);
graph.paddingBottom = CPTFloat(60.0);
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@(-1.0) length:@1.0];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@(-1.0) length:@1.0];
[self applyThemeToGraph:graph];
return graph;
}
然后这里报错:
+ (NSString *)strdatedateFormat:(NSString*)toDateFormat fromDateFormat:(NSString *)fromDateFormat objstr:(NSString*)objstr{
NSString *tmpbirthday = @"";
if(![NSStringQCTtoll isBlankString:objstr]){
tmpbirthday = objstr;
tmpbirthday = [QCT_Common date4ateFormat:toDateFormat withdate:[QCT_Common dateWithFormatterString:tmpbirthday dateFormat:fromDateFormat]];
}
return tmpbirthday;
}
+ (NSString *)date4ateFormat:(NSString *)DateFormat withdate:(NSDate *)date{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
// [formatter setDateStyle:NSDateFormatterMediumStyle];
// [formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateFormat:DateFormat];
return [formatter stringFromDate:date];
}
+ (NSDate*)dateWithFormatterString:(NSString*)dateWithString dateFormat:(NSString*)dateFormat {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
dateFormatter.dateFormat = dateFormat;
NSDate *date = [dateFormatter dateFromString:dateWithString];
return date;
}