I’d like that each time my app starts up (possibly even when it’s restored from background) it makes an action (for example TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];).
I’d also like that this action (on startup) can be disabled by a switch in the setting bundle of the app. What should I do? Thanks for your attention.
p.s. I apologize if I used incorrect words.. I’m a beginner 🙂
There are several methods which you can implement in your application delegate which are available in the
UIApplicationDelegateprotocol.When your app is first launched
applicationDidFinishLaunchingis called.When your app is restored from the background
applicationWillEnterForegroundis called.A switch which you add to your setting bundle will have a key, which is an
NSString, associated with it. A switch stores a boolean value encoded as anNSNumberin the standardNSUserDefaultsunder that key. You can read the value of the boolean from the standard user defaults and use it to determine whether to perform the action.Apples documentation on how to add a settings bundle is here.
In your settings bundle you’ll need a toggle switch. The key that you will look up in the standard user defaults is specified by the
Keyfield. The default value for your toggle switch is specified by theDefaultValuefield. See hereHere is what you need to do in your
applicationDidFinishLaunchingmethod