'first launch'에 해당되는 글 1건

  1. 2015.03.07 설치 후 처음 실행이라는 것을 파악하기
2015. 3. 7. 20:04


AppDelegate.m 에서 앱이 설치 후 처음 실행되었을 때 와 이미 실행된 적이 있을 때를 구분해서 코드를 만들어 줄 수 있다.

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

    // Override point for customization after application launch.

    if ([[NSUserDefaults standardUserDefaultsboolForKey:@"HasLaunchedOnce"])

    {

        // 설치 후 이미 실행한 적이 있을 때

    }

    else

    {

        // 설치 후 처음 실행

        [[NSUserDefaults standardUserDefaultssetBool:YES forKey:@"HasLaunchedOnce"]; // 처음 실행을 저장

        [[NSUserDefaults standardUserDefaultssynchronize];

    }

    return YES;

}



'개발 거들기 > iOS 개발' 카테고리의 다른 글

Sample(01) - Hello World (iOS-XCode)  (0) 2014.09.26
Posted by 모바일헌터