我想知道为什么它看起来没有“应用程序didFinishLaunchingWithOptions”被称为当我的应用程序启动时。我的NSLog(@“Launch!”)语句没有在控制台中显示出来,而且它之后的字典也没有被创建。如果它有所作为,我将使用导航控制器的Storyboard作为初始视图。我尝试在导航控制器中添加一个“对象”,并将其设置为“AppDelegate”,然后将其设置为参考插座,但这似乎也没有任何区别。每次应用程序启动时都不应该调用这种方法吗?我甚至重置模拟器,但仍然没有。应用程序didFinishLaunchingWithOptions没有被调用
谢谢。
//
// AppDelegate.m
// PersonLibraryiOS
//
// Created by Joey on 11/7/12.
// Copyright (c) 2012 Joey. All rights reserved.
//
#import "AppDelegate.h"
#import "AddViewController.h"
#import "Person.h"
@implementation AppDelegate
@synthesize PersonDict;
-(void)addtoDict:(Person *)newPerson
{
[PersonDict setObject:@"newPerson" forKey:[newPerson name]];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSLog (@"Launch!");
// Override point for customization after application launch.
return YES;
PersonDict = [NSMutableDictionary dictionaryWithContentsOfFile:@"diskDict"];
我能说什么,我是新的,并尽我所能去学习。事实证明,这是由于“返回YES”声明高于一切。谢谢。 –
对不起,如果你觉得我在嘲笑你,我不会;我是新来的。我认为学习Objective-C的最佳方式是获得一本好书;正确的跳跃和适应往往会导致对基本概念的误解。我从这方面的经验谈起。 – Metabble
我已经在这里待了几个月(我也一直在使用书籍),但有时在试图弄清更复杂的概念时,我倾向于忽视基本知识。感谢编辑BTW。我明白我的错在哪里。 –