Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.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
Ios 根控制器错误问题_Ios_Xcode - Fatal编程技术网

Ios 根控制器错误问题

Ios 根控制器错误问题,ios,xcode,Ios,Xcode,我正在尝试制作一个使用标签浏览的应用程序。我不知道如何正确地指定我的根控制器,xcode一直给我这个错误 “2013-10-13 18:51:56.688 FoxSays[23795:a0b]应用程序窗口预计在应用程序启动结束时会有一个根视图控制器” 该应用程序启动时只显示一个白色屏幕。有人告诉我,这是因为xcode无法确定应该显示哪个屏幕 我将发布我的代码,希望有人能帮助我。有一些随机未完成的东西在那里,但现在我只是想让它显示之前,我进一步。提前谢谢 // // FSAppDelegate.

我正在尝试制作一个使用标签浏览的应用程序。我不知道如何正确地指定我的根控制器,xcode一直给我这个错误

“2013-10-13 18:51:56.688 FoxSays[23795:a0b]应用程序窗口预计在应用程序启动结束时会有一个根视图控制器”

该应用程序启动时只显示一个白色屏幕。有人告诉我,这是因为xcode无法确定应该显示哪个屏幕

我将发布我的代码,希望有人能帮助我。有一些随机未完成的东西在那里,但现在我只是想让它显示之前,我进一步。提前谢谢

//
//  FSAppDelegate.h
//  FoxSays
//
//  Created by Scott Pfeiffer on 10/1/13.
//  Copyright (c) 2013 Bradley. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Parse/Parse.h>

@interface FSAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end


在appDelegate中,创建主根控制器的成员

@property (strong, nonatomic) FSHomeViewController * homeViewController
然后在排队之前

[self.window makeKeyAndVisible];
加:

别忘了包括标题- 在“appDelegate.h”中

在“appDelegate.m”中


我添加并运行了它。生成失败,出现以下错误,“使用未声明的标识符“homeViewController”和未知的接收器“FSHomeViewController”。在appDelegate.h中,添加@class FSHomeViewController,并在appDelegate.m中添加导入“FSHomeViewController.h”“我修补并找到了一个可行的解决方案,但我试图实施你的方案,看看它是否能让事情变得更顺利。整个应用程序现在崩溃了!啊(你介意现在发布你的appDelegate.h和.m的样子吗?我很乐意!我可能应该先解释一下我的可行解决方案。我想我没有经验,没有为选项卡栏控制器创建视图控制器。FSHomeController是我希望应用程序打开的选项卡。一旦我创建了新的视图控制器,应用程序就会启动。)虽然第一个选项卡的屏幕是黑色的,第二个由于不相关的原因无法工作,但至少我得到了这些选项卡。我不知道如何使用注释限制进行编码。想法?这解决了我的问题。我尝试并添加了另一个视图控制器,显然有效。我现在可以看到屏幕底部的选项卡,它们似乎可以工作但是,它给了我这样一条信息:“两阶段旋转动画不推荐使用。此应用程序应使用更平滑的单阶段动画。”我想我的下一个问题是,我的一个屏幕上应该有一个按钮,我可以点击。它在故事板上,但当我运行应用程序时,它只显示一个黑屏?为什么会这样?我可以做什么来修复它。如果需要,我可以再次发布代码。
 //
    //  FSHomeViewController.m
    //  FoxSays
    //
    //  Created by Scott Pfeiffer on 10/1/13.
    //  Copyright (c) 2013 Bradley. All rights reserved.
    //

    #import "FSHomeViewController.h"
    #import "FSItem.h"
    #import "FSItemStore.h"

    @interface FSHomeViewController ()

    @property (weak, nonatomic) IBOutlet UIButton *playAudio;

    @end

    @implementation FSHomeViewController

    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {
        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            // Custom initialization
        }
        return self;
    }



    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view.
    }

    - (void)didReceiveMemoryWarning
    {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }

    - (IBAction)playAudio:(id)sender {
        AVAudioPlayer *audioPlayer;
        NSString *audioPath = [[NSBundle mainBundle] pathForResource:@"Woof" ofType:@"mp3"];
        NSURL *audioURL = [NSURL fileURLWithPath:audioPath];
        NSError *audioError = [[NSError alloc] init];
        audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:audioURL error:&audioError];

        if (!audioError) {
            [audioPlayer play];
            NSLog(@"Woof!");
        }
        else {
            NSLog(@"Error!");
        }
    }



    @end
//
//  FSAnimalsViewController.h
//  FoxSays
//
//  Created by Scott Pfeiffer on 10/1/13.
//  Copyright (c) 2013 Bradley. All rights reserved.
//

#import <AVFoundation/AVAudioPlayer.h>
#import <UIKit/UIKit.h>
#import "FSDetailViewController.h"

@interface FSAnimalsViewController : UITableViewController
{
}
@end
//
//  FSAnimalsViewController.m
//  FoxSays
//
//  Created by Scott Pfeiffer on 10/1/13.
//  Copyright (c) 2013 Bradley. All rights reserved.
//

#import "FSAnimalsViewController.h"
#import "FSItemStore.h"
#import "FSItem.h"

@implementation FSAnimalsViewController
- (id)init
{
    // Call the superclass's designated initializer
    self = [super initWithStyle:UITableViewStyleGrouped];
    if (self)
    {
        UINavigationItem *n = [self navigationItem];

        [n setTitle:@"FoxSays"];

        // Create a new bar button item that will send
        // addNewItem: to ItemsViewController

        [[self navigationItem] setLeftBarButtonItem:[self editButtonItem]];

    }
    return self;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [[self tableView] reloadData];
}


- (id)initWithStyle:(UITableViewStyle)style
{
    return [self init];
}


- (void)tableView:(UITableView *)aTableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    FSDetailViewController *detailViewController = [[FSDetailViewController alloc] init];

    NSArray *items = [[FSItemStore defaultStore] allItems];
    FSItem *selectedItem = [items objectAtIndex:[indexPath row]];

    // Give detail view controller a pointer to the item object in row
    [detailViewController setItem:selectedItem];

    // Push it onto the top of the navigation controller's stack
    [[self navigationController] pushViewController:detailViewController
                                           animated:YES];
}


- (NSInteger)tableView:(UITableView *)tableView
 numberOfRowsInSection:(NSInteger)section
{
    return [[[FSItemStore defaultStore] allItems] count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Set the cell identifier
    static NSString *CellIdentifier = @"BasicCell";

    // Reuse the cell from the identifier
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    // Configure the cell if it doesn't exist
    if (!cell)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    // Log the row for debugging
    NSLog(@"%d", [indexPath row]);

    // Get object from store
    FSItem *item = [[[FSItemStore defaultStore] allItems] objectAtIndex:[indexPath row]];

    // Set label to from property in object
    [[cell textLabel] setText:[item title]];

    return cell;
}
@property (strong, nonatomic) FSHomeViewController * homeViewController
[self.window makeKeyAndVisible];
homeViewController = [[FSHomeViewController alloc] init];
self.window.rootViewController = homeViewController
@class FSHomeViewController
#import "FSHomeViewController"