
当我尝试运行该项目时,我有错误:
2012-11-07 22:46:34.719 mytableVIEwControl[12021:c07] The app delegate must implement the window property if it wants to use a main storyboard file.2012-11-07 22:46:34.722 mytableVIEwControl[12021:c07] -[AppDelegate setwindow:]: unrecognized selector sent to instance 0x7674e702012-11-07 22:46:34.723 mytableVIEwControl[12021:c07] *** Terminating app due to uncaught exception 'NSinvalidargumentexception',reason: '-[AppDelegate setwindow:]: unrecognized selector sent to instance 0x7674e70'*** First throw call stack:(0x1c8e012 0x10cbe7e 0x1d194bd 0x10df7ea 0x1c7dcf9 0x1c7d94e 0x1d60 0x107b7 0x10da7 0x11fab 0x23315 0x2424b 0x15cf8 0x1be9df9 0x1be9ad0 0x1c03bf5 0x1c03962 0x1c34bb6 0x1c33f44 0x1c33e1b 0x117da 0x1365c 0x1bd2 0x1b05)libc++abi.dylib: terminate called throwing an exception(lldb)
当我运行代码时,它挂在main.m上,并显示“thread1:signal SIGABRT”
@autoreleasepool {return UIApplicationMain(argc,argv,nil,NsstringFromClass([AppDelegate class])); 我的代码如下:
AppDelegate.h
//// AppDelegate.h// mytableVIEwControl//// Created by Max on 12-11-5.// copyright (c) 2012年 Max. All rights reserved.//#import <UIKit/UIKit.h>@interface AppDelegate : UIResponder <UIApplicationDelegate>@property (strong,nonatomic) UINavigationController *navigationController;@end
AppDelegate.m
//// AppDelegate.m// mytableVIEwControl//// Created by Max on 12-11-5.// copyright (c) 2012年 Max. All rights reserved.// #import "AppDelegate.h" #import "firstVIEwController.h"@implementation AppDelegate@synthesize navigationController;- (BOol)application:(UIApplication *)application dIDFinishLaunchingWithOptions: (NSDictionary *)launchOptions{ // create the base window UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; window.backgroundcolor = [UIcolor greencolor]; self.window = window; [window release]; // this is the home page from the user's perspective FirstVIEwController *fvc = [[FirstVIEwController alloc] init]; UINavigationController *nc = [[UINavigationController alloc]initWithRootVIEwController:fvc]; self.navigationController = nc; [fvc release]; [nc release]; // show them [self.window addSubvIEw: nc.vIEw]; [self.window makeKeyAndVisible]; return YES;}- (voID) dealloc{ [super dealloc];}- (voID)applicationWillResignActive:(UIApplication *)application{ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the Transition to the background state. // Use this method to pause ongoing tasks,disable timers,and throttle down OpenGL ES frame rates. Games should use this method to pause the game.}- (voID)applicationDIDEnterBackground:(UIApplication *)application{ // Use this method to release shared resources,save user data,invalIDate timers,and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution,this method is called instead of applicationWillTerminate: when the user quits.}- (voID)applicationWillEnterForeground:(UIApplication *)application{ // Called as part of the Transition from the background to the inactive state; here you can undo many of the changes made on entering the background.}- (voID)applicationDIDBecomeActive:(UIApplication *)application{ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was prevIoUsly in the background,optionally refresh the user interface.}- (voID)applicationWillTerminate:(UIApplication *)application{ // Called when the application is about to terminate. Save data if appropriate. See also applicationDIDEnterBackground:.}@end FirstVIEwController是列表视图控制器.
解决方法 您正在将窗口创建为局部变量,然后尝试通过使用self.window来访问它,就像它是一个属性一样.使它成为一个财产. 总结以上是内存溢出为你收集整理的ios – 如果要使用主要的故事板文件,应用程序委托必须实现该窗口属性全部内容,希望文章能够帮你解决ios – 如果要使用主要的故事板文件,应用程序委托必须实现该窗口属性所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)