Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 快速切换应用程序,我需要什么?_Iphone_Objective C_Multitasking_Fast App Switching - Fatal编程技术网

Iphone 快速切换应用程序,我需要什么?

Iphone 快速切换应用程序,我需要什么?,iphone,objective-c,multitasking,fast-app-switching,Iphone,Objective C,Multitasking,Fast App Switching,我的应用程序在没有多任务支持的情况下运行良好。 但当我在info.plist中激活它时,每当我按下navigationController上的某个按钮并按下home按钮,返回应用程序并再次使用navigationController时,它就会崩溃。 错误消息对我也没有帮助 当我只想让应用程序在后台什么都不做,然后在实际情况下返回时,我需要在我的应用程序中为多任务支持做些什么 不幸的是,由于Xcode 4.1--“,仪器也不能正常工作 控制台中的错误消息有时为: Terminating app d

我的应用程序在没有多任务支持的情况下运行良好。 但当我在info.plist中激活它时,每当我按下navigationController上的某个按钮并按下home按钮,返回应用程序并再次使用navigationController时,它就会崩溃。 错误消息对我也没有帮助

当我只想让应用程序在后台什么都不做,然后在实际情况下返回时,我需要在我的应用程序中为多任务支持做些什么

不幸的是,由于Xcode 4.1--“,仪器也不能正常工作

控制台中的错误消息有时为:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CAContextImpl _isCached]: unrecognized selector sent to instance 0x5b783d0'
有时,在我创建开关的视图中,它是一个EXC_BAD_…?但前提是我之前单击了home按钮! 如果我只按视图,然后返回。单击主页按钮。点击应用程序符号。然后再次尝试按同一视图,它会崩溃。 但当我按下视图,返回并按下视图时,它就工作了。只有当我在跳板上(点击主页按钮)时,它才会崩溃

编辑:


根据您的描述,多任务似乎不是问题所在。这看起来像是您的应用程序存在错误。您应该尝试跟踪并修复它


默认情况下,你的应用程序在后台不做任何事情。

你不必做任何事情。你可以做一些事情来更好地利用多任务,但开箱即用的iOS应该能够将你的应用程序恢复到你切换时的状态。怎么办?我总是遇到一些找不到选择器的错误,比如_isCached。但它不是他每次想要的同一个选择器。(通常与导航栏的DruckButtonBackgroundInRect:…有关)添加了代码,如果你有想法的话会很酷,因为它只在我在主屏幕上时才这样做,我不知道这个错误可能是什么。
//AppDelegate class

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    [window makeKeyAndVisible];
    [self loadHauptmenu];

    return YES;
}

- (void) loadHauptmenu {
    NSLog(@"loading Hauptmenu");
    navigationController = [[UINavigationController alloc] init];

    HauptMenuViewController *hauptMenuController = [[HauptMenuViewController alloc] init];
    [navigationController pushViewController:hauptMenuController animated:NO];
//    [hauptMenuController release]; //tried this as error, but wasn't it

    [window addSubview:navigationController.view];
}



//Main Menu class

- (void) pushNewViewController:(UIViewController*)pushMe {
    NSLog(@"Der aktuelle navigationController ist: %@", self.navigationController);

    [self.navigationController pushViewController:pushMe animated:YES];
}

- (void) pushNewViewWithClassname:(NSString*)classname {
    UIViewController *viewControllerToPush = [[NSClassFromString(classname) alloc] init];
    [self pushNewViewController:viewControllerToPush];
    [viewControllerToPush release];
}


- (IBAction) pushEinstellungen:(id)sender {
    [self pushNewViewWithClassname:@"EinstellungenViewController"];
}


//view class, which gets pushed

- (id) init {
    self = [super init];
    if (self != nil) {
        self.title = @"Einstellungen";
        //self.view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 416)];
        self.view.backgroundColor = MEDILEARN_COLOR;

        self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 416) style:UITableViewStyleGrouped];
        self.tableView.delegate = self;
        self.tableView.dataSource = self;
        self.tableView.allowsSelection = NO;
        self.tableView.backgroundColor = [UIColor clearColor];
        [self.view addSubview:self.tableView];

        self.fragenSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(194, 8, 94, 28)]; //here is an EXC_BAD_...
        [self.fragenSwitch addTarget:self action:@selector(toggleEnabledForFragenSwitch:) forControlEvents:UIControlEventValueChanged];
        [self.fragenSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@"randFragen"] animated:NO];

        self.antwortenSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(194, 8, 94, 28)];
        [self.antwortenSwitch addTarget:self action:@selector(toggleEnabledForAntwortenSwitch:) forControlEvents:UIControlEventValueChanged];
        [self.antwortenSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@"randAntworten"] animated:NO];
    }
    return self;
}