我遇到了一个非常奇怪的问题——我的测试人员在 3GS 上报告了问题(应用程序挂起,没有崩溃),但在 3G 上却没有……这是我假设问题所在的代码:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
[FlurryAPI startSession:@"myflurryapisessionkey"];
[FlurryAPI setSessionReportsOnCloseEnabled:NO];
// set managedObjectContext on TabBarController
tabBarController.managedObjectContext = self.managedObjectContext;
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
// check if we have to show a favorite immediately
Favorite *startseiteFavorite = [self getStartSeiteFavorite];
if (startseiteFavorite != nil) {
[FlurryAPI logEvent:@"favorite found"];
[self showStartseiteFavorite:startseiteFavorite];
} else {
[FlurryAPI logEvent:@"no favorite found"];
}
}
- (Favorite *) getStartSeiteFavorite {
// loading values
smart_infoAppDelegate *appDelegate = (smart_infoAppDelegate *)[[UIApplication sharedApplication] delegate];
managedObjectContext = [appDelegate managedObjectContext];
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Favorite" inManagedObjectContext:managedObjectContext];
[request setEntity:entity];
NSPredicate * predicate;
predicate = [NSPredicate predicateWithFormat:@"startseite == 1"];
[request setPredicate:predicate];
NSError *error;
NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
[request release];
Favorite *tempFavorite = [mutableFetchResults count] > 0 ? [mutableFetchResults objectAtIndex:0] : nil;
[mutableFetchResults release];
return tempFavorite;
}
我想根据这样的'startseiteFavorite'的存在来选择一个标签-如果有,我选择标签1,否则选择标签0...你们中的任何人都发现问题或原因吗这在 3G 中没有问题,但在 3GS 中没有问题?
非常感谢,
斯特凡