最近我遇到了一个问题,我的应用程序在初始启动时进入后台,但这仅发生在带有 iOS6 的 iPhone 4S 上。我已经测试过:
- 模拟器,具有不同的硬件/软件配置
- iPhone 5 (iOS 6)
- iPhone 4S (iOS 5.1)
- iPad2 (iOS 6)
它对所有这些都有效,但在带有 iOS6 的 iPhone 4S 上,应用程序的启动大约需要 20 秒才能进入后台,如果你在几秒钟后“重新启动”应用程序,你会看到它仍在运行并且工作没有任何问题。
iPhone4S(iOS6)是否有任何已知问题导致此问题或此型号有什么特别之处?[我已经在不同的 iPhone4s (iOS6) 上对其进行了测试,并且所有这些都发生了]
编辑
我注意到一些奇怪的东西会做更多的测试,iPhone 4s(iOS6)是唯一不显示加载屏幕(第一个视图控制器)的,它只显示启动图像..无论如何,这是 AppDelegate 的代码和第一个视图控制器:
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// Optional: automatically track uncaught exceptions with Google Analytics.
[GAI sharedInstance].trackUncaughtExceptions = YES;
// Optional: set Google Analytics dispatch interval to e.g. 20 seconds.
[GAI sharedInstance].dispatchInterval = 20;
// Optional: set debug to YES for extra debugging information.
[GAI sharedInstance].debug = NO;
// Create tracker instance.
__unused id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"UA-APP-ID"];
return YES;
}
EcraPrincipalViewController.m
#import "EcraPrincipalViewController.h"
#import "ListaPercursosTableViewController.h"
#import "GlobalVars.h"
#import "AppDelegate.h"
@interface EcraPrincipalViewController ()
@end
@implementation EcraPrincipalViewController
{
int progresso;
int sizePercursos;
}
@synthesize lbl_versao;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.trackedViewName = @"iPhone - EcrãPrincipal";
// Do any additional setup after loading the view.
NSMutableArray *views = [[NSMutableArray alloc] initWithArray:[self.navigationController viewControllers]];
UIStoryboard *story = [UIStoryboard storyboardWithName:@"WalkMeStoryBoard" bundle:nil];
ListaPercursosTableViewController *listaV = [story instantiateViewControllerWithIdentifier:@"view_lista"];
[views replaceObjectAtIndex:0 withObject:listaV];
[self.navigationController setViewControllers:views];
lbl_info.text = NSLocalizedString(@"downloading", NULL);
lbl_versao.text = NSLocalizedString(@"walkme_versao", NULL);
dispatch_queue_t queue = dispatch_queue_create("com.WalkMe.downloadPercursos", NULL);
dispatch_async(queue, ^{
[[GlobalVars Instance] getLevadas:self];
});
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (BOOL)shouldAutorotate
{
return [[GlobalVars Instance] podeRodar];
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)novaAtualizacao
{
NSLog(@"Atualização encontrada");
lbl_info.text = NSLocalizedString(@"atualizacao_encontrada", NULL);
}
-(void)atualizarPercursosInternos
{
NSLog(@"VERIFICAÇAO Interna");
lbl_info.text = NSLocalizedString(@"a_atualizar_percursos", NULL);
}
-(void)setNewDownload:(NSNumber*)size
{
NSLog(@"Iniciou VERIFICAÇAO");
progresso = 0;
sizePercursos = [size intValue];
lbl_info.text = [NSString stringWithFormat:@"%@ 0/%d", NSLocalizedString(@"novos_percursos", NULL), sizePercursos];
}
-(void)setProgress
{
NSLog(@"Progresso");
progresso++;
lbl_info.text = [NSString stringWithFormat:@"%@ %d/%d", NSLocalizedString(@"novos_percursos", NULL), progresso, sizePercursos];
}
-(void)goToLista
{
NSLog(@"ACABOU VERIFICAÇAO");
UIStoryboard *story = [UIStoryboard storyboardWithName:@"WalkMeStoryBoard" bundle:nil];
[[GlobalVars Instance] getLevadas];
[self.navigationController pushViewController:[story instantiateViewControllerWithIdentifier:@"view_lista"] animated:NO];
}
- (void)viewDidUnload {
[self setLbl_versao:nil];
[super viewDidUnload];
}
@end
非常感谢您的关注和帮助:)