Checking If You App Has Been Run Before

/ Published in: Objective C
Save to your folder(s)

Do you need you app to do something when it is first run on a certain computer? Do you need to know if it has been run before? Enter the following code into your Application Delegate.

This code creates a BOOL that is created when the app is run. The if-else statement reads the value of the BOOL -- Yes or No. NOTE: You'll notice that if you run the app from xcode with the run button it says "Not run before". When you run it again it still says that. In order to truly test locate you apps Debug .app application then run that. Xcode clears out the data when you run it again. IT DOES WORK though, so don't worry if running you app in Xcode still gives you the Not Run Before result.


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.