uiapplicationdelegate

Using applicationwillenterforeground for a passcode screen

风格不统一 提交于 2020-01-01 05:19:13
问题 Before iOS4, my app's initial view controller would check a passcode on/off settings variable in viewWillAppear and if set on, present a modal passcode screen that would stay there until the correct passcode was entered or the Home button was pressed. With iOS4, if my app has been in the background, I would like the user to feel comfortable that the data contained within the app is not easily accessible if they were to hand their phone to someone to use. Since the app could return to any

Display a view or splash screen before applicationDidEnterBackground (to avoid active view screenshot)

对着背影说爱祢 提交于 2019-12-27 14:05:48
问题 I have confidential informations in my app, so I would like to hide them with a splash screen when the app is about to be moved to background. I do run the app on iOS6 and further. I tried to display the view in applicationWillResignActive but the problem is it display the splash screen even when user swipe control panel for example. I want it to show only when the app is moved to background. I tried to displayed my splashScreen in applicationDidEnterBackground but it takes the screenShot

Display a view or splash screen before applicationDidEnterBackground (to avoid active view screenshot)

前提是你 提交于 2019-12-27 14:04:42
问题 I have confidential informations in my app, so I would like to hide them with a splash screen when the app is about to be moved to background. I do run the app on iOS6 and further. I tried to display the view in applicationWillResignActive but the problem is it display the splash screen even when user swipe control panel for example. I want it to show only when the app is moved to background. I tried to displayed my splashScreen in applicationDidEnterBackground but it takes the screenShot

Overriding initialize on an AppDelegate - Protecting against code executing multiple times

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 08:25:51
问题 Overriding initialize() is common for executing code before a class is sent its first message (setting UserDefaults, etc). The documentation states that a superclass' implementation may be called multiple times subclasses do not override initialize() , and give an example of a way to protect a class from executing code more than once if initialize() is called several times: The superclass implementation may be called multiple times if subclasses do not implement initialize() —the runtime will

How to differentiate lock screen and home button (background multitasking) on applicationWillResignActive in the app delegate

牧云@^-^@ 提交于 2019-12-25 07:47:08
问题 I am writing an alarm clock app. Please correct me if I am wrong: On both events (lock & home button in iOS 4.x) the applicationWillResignActive: method is called. When locked my app can keep on running (forever if DeepSleepPreventer.h is used) to check if the alarm should go off. When home is pressed it has to stop working at some time (apart from some basic background calculations). So in this case I have to set a local UILocalNotification to trigger the alarm. So my question: How to

UIApplication sharedAppication error: program seems to be accessing wrong file

…衆ロ難τιáo~ 提交于 2019-12-25 01:34:30
问题 in my MainViewController implementation, I need to access variables from two different classes. one of the classes is the AppDelegate and the other is the FlipsideViewController. the way I accessed these was through this code: -(void)someMethod { MyApplicationAppDelegate *appDelegate = (MyApplicationAppDelegate *)[[UIApplication sharedApplication] delegate]; FlipsideViewController *viewController = (FlipsideViewController *)[[UIApplication sharedApplication] delegate]; then I have an array I

does something need to hold a reference to a singleton objective-c object in order to preserve it through the life of an IOS app?

会有一股神秘感。 提交于 2019-12-24 04:05:23
问题 does something need to hold a reference to a singleton objective-c object in order to preserve it through the life of an IOS app? For example if if AppDelegate you created/instantiated a singleton object but didn't retain it, would this instance (with instance variable data) be available later on in the iPhone app? In other words to ensure data in the singleton remains intact, in the App Delegate where it was initially created, would the App Delegate need to retain it to one of it's instance

sleep mode vs notification center open

旧街凉风 提交于 2019-12-24 00:44:47
问题 in both, 1) iPhone goes in Sleep mode 2) Open notification Center It calls - (void)applicationWillResignActive:(UIApplication *)application Is there any way to identify if this method is called because device went in to sleep mode or by opening notification center? 回答1: There are some hacks to detect lock/unlock, but nothing official that couldn't break with a future iOS release. 回答2: OK, When you lock your screen/iPhone goes to sleep mode , the front most app(Your app) will go to background

How send application to background when install on device?

时光怂恿深爱的人放手 提交于 2019-12-24 00:39:16
问题 I am making an application in which i want features like as when i run my app on device then it will closed immediately without showing any screen.But Application works in background. When user click on icon of application then it will not show any screen but work in background. After 2 minutes gap it will show a alert message. How do that? I have used code for this given below:- -(void)applicationDidFinishLaunching:(UIApplication *)application{ [application cancelAllLocalNotifications];

Use NSMutableArray in app delegate in another class

无人久伴 提交于 2019-12-23 06:06:13
问题 I have an NSMutableArray in my app delegate. I wish to use that mutable array in a different class in my program, as if it were a global variable. How would I do this? Is it as simple as importing the header and referencing the object? 回答1: Take advantage of the UIApplication singleton: YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate]; Then, access your array property like this: appDelegate.yourArrayProperty 回答2: Make you array a property of your