iOS 9: 按钮上的黑色背景,以及在某些设备上的性能错误
iOS 9: Black Background on buttons, and performance errors on some devices
我们有一个案例,其中 4 个 iPads 运行 我们的应用程序中有 3 个符合预期,然后在一个没有加载大量 (x,y) 点的应用程序上图表,与屏幕截图的唯一区别是导航中“<返回”按钮的黑色背景。它看起来也像 iOS 5 和 6 上的旧后退按钮? (更新:阅读 rmaddy 关于“常规”>“辅助功能” 中 "Button Shapes" 设置的评论)
VS
Version is 9.0.2(13A452), Wi-Fi only, and Model is
MD510LL/A
VS.
Version is 9.0.2(13A452), Carrier is Verizon 21.1 and Model is
MD524LL/A
黑色按钮之一是 iPad 第 4 代 运行ning iOS 9 并且该设备上只有老式黑色背景?我将 window.tintColor 更改为黑色以修复白色文本不可读的 UIAlertAction 错误,所以这可能解释了部分原因?
绘图问题
主要问题是加载核心绘图时,在一小部分设备 上,所有 x 值在时间间隔增量循环期间都保持为零 。我以前见过 32 位设备在执行此操作时失败,而第 4 代是 32 位的。然而...我个人测试了 iPad 第四代,其规格与上述第二代相同。
在我的测试设备上,一切都按预期工作...就仅 Wi-Fi 的差异而言,Verizon/ATT,以及对这些问题的所有 32 位/64 位解释,我发现这很有帮助:http://www.everymac.com/systems/apple/ipad/ipad-air-faq/differences-between-ipad-air-ipad-4th-gen.html
iOS9 中的某些新设置是否会影响在 wifi 不可用时使用 Verizon 数据计划联网的能力,例如 "Low Power Mode"?这是目前的情况,包括有问题的设备在 VPN 上。
同样,这是两个不同的设备运行使用相同的应用程序!黑色背景的设备在加载图表数据时出现问题。 iOS 9 中是否有新设置会导致这些奇怪的 differences/errors 从设备到设备?
注意:最近发现一位用户的 iPhone 6s+ 有同样的图形错误,所以这不仅仅是 iPad 相关...
以下是从 SOAP 响应对象填充 (x,y) 坐标的方式:
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"MM/dd/yyyy h:mm:ss a"];
if (unitCount == 0)
{
DataHistory_object *dho = [[DataHistory_object alloc] init];
dho.dataDate = [attributeDict objectForKey:@"Date"];
NSLog(@"dho.dataDate: %@",dho.dataDate);
dho.dataValue = [attributeDict objectForKey:@"Value"];
float dataValue = [dho.dataValue floatValue];
newDate = [dateFormat dateFromString:dho.dataDate];
[[NSUserDefaults standardUserDefaults] setObject:dho.dataDate forKey:@"firstDate"];
//@"start" is defined in a separate class
if (![[[NSUserDefaults standardUserDefaults] objectForKey:@"start"] isEqualToString:dho.dataDate])
{
NSDate *start = [dateFormat dateFromString:[[NSUserDefaults standardUserDefaults] objectForKey:@"start"]];
firstDate = [dateFormat dateFromString:dho.dataDate];
NSTimeInterval secondsBetween = [firstDate timeIntervalSinceDate:start];
interval = secondsBetween;
NSString *startDate = [NSString stringWithFormat:@"%@",[dateFormat stringFromDate:newDate]];
NSLog(@"firstDate: %@",startDate);
NSLog(@"unitCount == 0 if: %d - interval: %f",unitCount,interval);
}
else
{
NSLog(@"unitCount == 0 else: %d - interval: %f",unitCount,interval);
}
if (trendIndex == 0)
{
[dataHistoryArray addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 1)
{
[dataHistoryArray2 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 2)
{
[dataHistoryArray3 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 3)
{
[dataHistoryArray4 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 4)
{
[dataHistoryArray5 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 5)
{
[dataHistoryArray6 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 6)
{
[dataHistoryArray7 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
oldDate = newDate;
unitCount++;
}
else
{
DataHistory_object *dho = [[DataHistory_object alloc] init];
dho.dataDate = [attributeDict objectForKey:@"Date"];
dho.dataValue = [attributeDict objectForKey:@"Value"];
float dataValue = [dho.dataValue floatValue];
newDate = [dateFormat dateFromString:dho.dataDate];
NSTimeInterval secondsBetween = [newDate timeIntervalSinceDate:oldDate];
interval = (interval + secondsBetween);
NSLog(@"unitCount %d - interval: %f",unitCount,interval);
if (trendIndex == 0)
{
[dataHistoryArray addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 1)
{
[dataHistoryArray2 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 2)
{
[dataHistoryArray3 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 3)
{
[dataHistoryArray4 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 4)
{
[dataHistoryArray5 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 5)
{
[dataHistoryArray6 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 6)
{
[dataHistoryArray7 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
oldDate = newDate;
unitCount++;
}
数组的加载方式如下:
-(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot {
if ([(NSString *)plot.identifier isEqualToString:@"Blue"])
{
return [dataHistoryArray count];
}
//...same code for other arrays and colors
return 0;
}
-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index {
NSNumber *num;
if ([(NSString *)plot.identifier isEqualToString:@"Blue"])
{
num = [[dataHistoryArray objectAtIndex:index] valueForKey:(fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y")];
return num;
}
//...same for other arrays and colors
return 0;
}
我还需要在添加每个绘图后操作图形:
-(void)changePlotRange {
y.orthogonalCoordinateDecimal = CPTDecimalFromFloat(appDelegate.lowY);
plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0.0f) length:CPTDecimalFromFloat([[NSUserDefaults standardUserDefaults] floatForKey:@"secondsBetween"])];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(appDelegate.lowY) length:CPTDecimalFromFloat(appDelegate.highY-appDelegate.lowY)];
}
什么时候设置 secondsBetween
默认值?某些设备上可能存在时间问题,导致应用检索到错误的值。
您还可以使用 [plotSpace scaleToFitPlots:[graph allPlots]]
在将新数据添加到任何绘图后重新计算绘图 space 范围。
意识到这不是获得公认答案的最简单问题,我将用我发现的内容更新此 post。
一些用户报告图表左侧所有数据被压缩的绘图问题是由于这些用户 运行 在军事时间 。我使用 NSDateFormatter 的间隔计算从未考虑到这一点。我最终为 NSDateFormatter 创建了一个类别,无论日期格式如何,它都按照现有代码所期望的方式处理日期。
关于按钮颜色的不同,Rick Maddy 在评论中回答了,所以我无法接受他的回答:
The device with the black button has enabled the "Button Shapes" option under General => Accessibility in the Settings app. This was added in iOS 7.
我们有一个案例,其中 4 个 iPads 运行 我们的应用程序中有 3 个符合预期,然后在一个没有加载大量 (x,y) 点的应用程序上图表,与屏幕截图的唯一区别是导航中“<返回”按钮的黑色背景。它看起来也像 iOS 5 和 6 上的旧后退按钮? (更新:阅读 rmaddy 关于“常规”>“辅助功能” 中 "Button Shapes" 设置的评论)
Version is 9.0.2(13A452), Wi-Fi only, and Model is MD510LL/A
VS.
Version is 9.0.2(13A452), Carrier is Verizon 21.1 and Model is MD524LL/A
黑色按钮之一是 iPad 第 4 代 运行ning iOS 9 并且该设备上只有老式黑色背景?我将 window.tintColor 更改为黑色以修复白色文本不可读的 UIAlertAction 错误,所以这可能解释了部分原因?
绘图问题
主要问题是加载核心绘图时,在一小部分设备 上,所有 x 值在时间间隔增量循环期间都保持为零 。我以前见过 32 位设备在执行此操作时失败,而第 4 代是 32 位的。然而...我个人测试了 iPad 第四代,其规格与上述第二代相同。
在我的测试设备上,一切都按预期工作...就仅 Wi-Fi 的差异而言,Verizon/ATT,以及对这些问题的所有 32 位/64 位解释,我发现这很有帮助:http://www.everymac.com/systems/apple/ipad/ipad-air-faq/differences-between-ipad-air-ipad-4th-gen.html
iOS9 中的某些新设置是否会影响在 wifi 不可用时使用 Verizon 数据计划联网的能力,例如 "Low Power Mode"?这是目前的情况,包括有问题的设备在 VPN 上。
同样,这是两个不同的设备运行使用相同的应用程序!黑色背景的设备在加载图表数据时出现问题。 iOS 9 中是否有新设置会导致这些奇怪的 differences/errors 从设备到设备?
注意:最近发现一位用户的 iPhone 6s+ 有同样的图形错误,所以这不仅仅是 iPad 相关...
以下是从 SOAP 响应对象填充 (x,y) 坐标的方式:
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"MM/dd/yyyy h:mm:ss a"];
if (unitCount == 0)
{
DataHistory_object *dho = [[DataHistory_object alloc] init];
dho.dataDate = [attributeDict objectForKey:@"Date"];
NSLog(@"dho.dataDate: %@",dho.dataDate);
dho.dataValue = [attributeDict objectForKey:@"Value"];
float dataValue = [dho.dataValue floatValue];
newDate = [dateFormat dateFromString:dho.dataDate];
[[NSUserDefaults standardUserDefaults] setObject:dho.dataDate forKey:@"firstDate"];
//@"start" is defined in a separate class
if (![[[NSUserDefaults standardUserDefaults] objectForKey:@"start"] isEqualToString:dho.dataDate])
{
NSDate *start = [dateFormat dateFromString:[[NSUserDefaults standardUserDefaults] objectForKey:@"start"]];
firstDate = [dateFormat dateFromString:dho.dataDate];
NSTimeInterval secondsBetween = [firstDate timeIntervalSinceDate:start];
interval = secondsBetween;
NSString *startDate = [NSString stringWithFormat:@"%@",[dateFormat stringFromDate:newDate]];
NSLog(@"firstDate: %@",startDate);
NSLog(@"unitCount == 0 if: %d - interval: %f",unitCount,interval);
}
else
{
NSLog(@"unitCount == 0 else: %d - interval: %f",unitCount,interval);
}
if (trendIndex == 0)
{
[dataHistoryArray addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 1)
{
[dataHistoryArray2 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 2)
{
[dataHistoryArray3 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 3)
{
[dataHistoryArray4 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 4)
{
[dataHistoryArray5 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 5)
{
[dataHistoryArray6 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 6)
{
[dataHistoryArray7 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
oldDate = newDate;
unitCount++;
}
else
{
DataHistory_object *dho = [[DataHistory_object alloc] init];
dho.dataDate = [attributeDict objectForKey:@"Date"];
dho.dataValue = [attributeDict objectForKey:@"Value"];
float dataValue = [dho.dataValue floatValue];
newDate = [dateFormat dateFromString:dho.dataDate];
NSTimeInterval secondsBetween = [newDate timeIntervalSinceDate:oldDate];
interval = (interval + secondsBetween);
NSLog(@"unitCount %d - interval: %f",unitCount,interval);
if (trendIndex == 0)
{
[dataHistoryArray addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 1)
{
[dataHistoryArray2 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 2)
{
[dataHistoryArray3 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 3)
{
[dataHistoryArray4 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 4)
{
[dataHistoryArray5 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 5)
{
[dataHistoryArray6 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
if (trendIndex == 6)
{
[dataHistoryArray7 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
}
oldDate = newDate;
unitCount++;
}
数组的加载方式如下:
-(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot {
if ([(NSString *)plot.identifier isEqualToString:@"Blue"])
{
return [dataHistoryArray count];
}
//...same code for other arrays and colors
return 0;
}
-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index {
NSNumber *num;
if ([(NSString *)plot.identifier isEqualToString:@"Blue"])
{
num = [[dataHistoryArray objectAtIndex:index] valueForKey:(fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y")];
return num;
}
//...same for other arrays and colors
return 0;
}
我还需要在添加每个绘图后操作图形:
-(void)changePlotRange {
y.orthogonalCoordinateDecimal = CPTDecimalFromFloat(appDelegate.lowY);
plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0.0f) length:CPTDecimalFromFloat([[NSUserDefaults standardUserDefaults] floatForKey:@"secondsBetween"])];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(appDelegate.lowY) length:CPTDecimalFromFloat(appDelegate.highY-appDelegate.lowY)];
}
什么时候设置 secondsBetween
默认值?某些设备上可能存在时间问题,导致应用检索到错误的值。
您还可以使用 [plotSpace scaleToFitPlots:[graph allPlots]]
在将新数据添加到任何绘图后重新计算绘图 space 范围。
意识到这不是获得公认答案的最简单问题,我将用我发现的内容更新此 post。
一些用户报告图表左侧所有数据被压缩的绘图问题是由于这些用户 运行 在军事时间 。我使用 NSDateFormatter 的间隔计算从未考虑到这一点。我最终为 NSDateFormatter 创建了一个类别,无论日期格式如何,它都按照现有代码所期望的方式处理日期。
关于按钮颜色的不同,Rick Maddy 在评论中回答了,所以我无法接受他的回答:
The device with the black button has enabled the "Button Shapes" option under General => Accessibility in the Settings app. This was added in iOS 7.