Questions tagged [uiapplicationdelegate]

UIApplicationDelegate is a part of the UIKit framework used in iOS development

UIApplicationDelegate Protocol is available in /System/Library/Frameworks/UIKit.framework since iOS 2.0.

It declares methods that are implemented by the delegate of UIApplication object. It gives information on key events during application execution (finish launching, terminated, low memory, ...) (from iOS developer guide)

initial help

sample code

  • Could be found also in the official documentation
523 questions
5
votes
2 answers

HKObserverQuery randomly called twice in a row

I have an issue I'm trying to solve, I've setup an HKObserveryQuery, which works great and gathers new data for me. The issue however is that sometimes when I go back to the Health app and delete an item after I've manually added it to the Health…
klcjr89
  • 5,862
  • 10
  • 58
  • 91
5
votes
6 answers

Why not subclass UIApplication? Why use a delegate?

Instead of using an application delegate so that the UIApplication singleton can call the delegate methods at predefined time, what are the advantages and disadvantages of just subclassing UIApplication? (update: why does the iOS architecture use…
Jeremy L
  • 3,770
  • 6
  • 41
  • 62
4
votes
2 answers

AppDelegate class not found

I imported the AppDelegate.h in a lot of classes with: #import "AppDelegate.h" @interface LoginViewController : UIViewController { } @property (nonatomic, retain) AppDelegate *app; but somehow it stopped working in my…
Youri
  • 136
  • 2
  • 10
4
votes
2 answers

clickedButtonAtIndex in appdelegate is not called

I am calling UIAlert with 2 buttons "Cancel" and "OK" in MyapplicationAppDelegate.m file , the alert is called but on tap of "Cancel" or "OK" button -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex method is…
User97693321
  • 3,336
  • 7
  • 45
  • 69
4
votes
1 answer

SwiftUI - 'windows' was deprecated in iOS 15.0: Use UIWindowScene.windows

I'm having the following code block: struct StackOverflow: View { var body: some View { Text("Hello, World!") .padding(.bottom,UIApplication.shared.windows.first?.safeAreaInsets.bottom ?? 15) } } However, this returns…
SwiftUIRookie
  • 591
  • 7
  • 16
4
votes
3 answers

How do I update the screen before applicationDidBecomeActive?

I need to hide something on the screen when the user has activates the application by switching it to the foreground. I have tried inserting my code within applicationDidBecomeActive or applicationWillEnterForeground and although it runs OK the old…
iphaaw
  • 6,764
  • 11
  • 58
  • 83
4
votes
1 answer

UIApplicationDelegate openURL with multiple files

I'm trying to allow my app to open multiple files at the same time - e.g. select multiple with files app, then press "open in [my app]". When I try this, sure enough UIApplicationDelegate openURL fires in my app, but I only get one URL. Is there a…
mazbox
  • 613
  • 1
  • 5
  • 7
4
votes
1 answer

Autologout iphone app

I'm looking to make an iphone that will log a user out of a session once the app has been either idle in the foreground or in the background for a specified period of time. I'm guessing that I should use an NSTimer, but I don't know where to start…
Cyrus
  • 3,687
  • 5
  • 35
  • 67
4
votes
0 answers

How to open an internal page using a Universal Link in iOS

So, I use a 3rd party SDK, CleverTap, for analytics which also sends out in-app notifications - for which I have to provide a URL. Now Universal links from an external app work fine on my app, however, when I UIApplication.shared.open() the same…
4
votes
3 answers

Is it good practice to use AppDelegate for data manipulation and Handling?

I am making an object of AppDelegate and using it throughout my program, and I have declared all setters and getters, and also insert, select, delete, update queries of database in it. I want to ask that is it a good practice to do so, if yes, then…
Chatar Veer Suthar
  • 15,541
  • 26
  • 90
  • 154
4
votes
1 answer

viewDidAppear, but also when app returns from background

I have a UIView ("content") that is a white view with a large red dot. When the app first launches, I want the dot to fade in (just a half sec). Whenever that view appears again (so, user has been on some other screen and comes back to that screen),…
Fattie
  • 27,874
  • 70
  • 431
  • 719
4
votes
2 answers

What is the equivalent of UIApplication.sharedApplication().delegate in WatchKit?

In an iOS application, you can obtain a reference to the shared app delegate by: Swift: let delegate = UIApplication.sharedApplication().delegate as! AppDelegate Objective-C: AppDelegate *delegate = [[UIApplication sharedApplication] delegate]; In a…
4
votes
2 answers

iOS unbalanced calls to applicationWillResignActive: and applicationDidBecomeActive:

When my app goes to the background, it has to blur the current screen for data protection reasons. The content of the screen must not be seen in the task manager window, so the blurring routine has to be done before the app quits. As every UI…
4
votes
2 answers

UIApplicationBackgroundRefreshStatusDidChangeNotification usage without corresponding delegate method

I feel that UIApplicationBackgroundRefreshStatusDidChangeNotification introduced in iOS 7 is of little use without supporting UIApplication delegate method. Because, the app is not notified when user has switch ON the background refresh state for my…
4
votes
3 answers

UIApplication sharedApplication keeps executing when going back to the app and relaunching

The following code works fine but when I go back to my app it keeps on executing the following code but I don't know why and how to stop it. I think it is only happening in ios5.0 : app flow - rootviewcontroller -> mainviewcontroller ->webview the…
Jatin
  • 1,668
  • 2
  • 16
  • 23