Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.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 如何调用具有多个参数的bool类型函数_Iphone_Objective C - Fatal编程技术网

Iphone 如何调用具有多个参数的bool类型函数

Iphone 如何调用具有多个参数的bool类型函数,iphone,objective-c,Iphone,Objective C,我如何在它所在类的另一个方法中调用该函数。这是一个委托方法,您永远不会显式调用它 一旦应用程序完成启动,就会调用它 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"])

我如何在它所在类的另一个方法中调用该函数。

这是一个委托方法,您永远不会显式调用它

一旦应用程序完成启动,就会调用它

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"])
    {
        // app already launched
        return NO;
    }
    else
    {
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedOnce"];
        [[NSUserDefaults standardUserDefaults] synchronize];
        // This is the first launch ever
        return  YES;
    }
}

你可以在应用程序中的任何地方使用它。

我不明白你为什么要调用委托方法?为了便于理解,永远不能显式调用委托。你为什么拒绝?阅读苹果开发者文档,看看这个方法的用途。你到底想要什么?
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];

// to access the value of HasLaunchedOnce, write:
[preferences valueForKey:@"HasLaunchedOnce"]; 

// to set the value of HasLaunchedOnce, write:
[preferences setValue:TRUE forKey:@"HasLaunchedOnce"];