Questions tagged [uiapplication]

The UIApplication class provides a centralized point of control and coordination for apps running on iOS. Every app must have exactly one instance of UIApplication (or a subclass of UIApplication). When an app is launched, the UIApplicationMain function is called; among its other tasks, this function creates a singleton UIApplication object. Thereafter you access this object by invoking the sharedApplication class method.

The UIApplication class provides a centralized point of control and coordination for apps running on iOS. Every app must have exactly one instance of UIApplication (or a subclass of UIApplication). When an app is launched, the UIApplicationMain function is called; among its other tasks, this function creates a singleton UIApplication object. Thereafter you access this object by invoking the sharedApplication class method.

A major role of a UIApplication object is to handle the initial routing of incoming user events. It also dispatches action messages forwarded to it by control objects (UIControl) to the appropriate target objects. In addition, the UIApplication object maintains a list of all the windows (UIWindow objects) currently open in the app, so through those it can retrieve any of the app’s UIView objects. The app object is typically assigned a delegate, an object that the app informs of significant runtime events—for example, app launch, low-memory warnings, and app termination—giving it an opportunity to respond appropriately.

Apps can cooperatively handle a resource such as an email or an image file through the openURL: method. For example, an app opening an email URL with this method may cause the mail client to launch and display the message.

The programmatic interfaces of UIApplication allow you to manage behavior that is specific to the device. Use this object to do the following:

  • Control the app’s response to changes in interface orientation.

  • Temporarily suspend incoming touch events.

  • Turn proximity sensing (of the user’s face) off and on again.

  • Register for remote notifications.

  • Trigger the undo-redo UI (applicationSupportsShakeToEdit).

  • Determine whether an installed app can open a URL (canOpenURL:).

  • Extend the execution of the app so that it can finish a task in the background.

  • Schedule and cancel local notifications.

  • Coordinate the reception of remote-control events.

  • Perform app-level state restoration tasks.

UIApplication defines a delegate that must adopt the UIApplicationDelegate protocol and implement some of the protocol methods.

Subclassing Notes

Most apps should never need to subclass the UIApplication class. Most apps use an app delegate to manage interactions between the system and the app.

The only situation where you might need to subclass UIApplication is when you are implementing a custom event or action dispatching mechanism. In that situation, you might override the sendEvent: or sendAction:to:from:forEvent: methods to implement that mechanism. However, the cases where this is required are very rare and should be avoided whenever possible.

484 questions
0
votes
0 answers

Crash in UIApplication.isIdleTimerDisabled

I have a published app that has a need to keep the display on for an extended period of time. I use UIApplication.isIdleTimerDisabled to control it, setting it true when I need to keep the display on, and setting it false when it's no longer…
Jerry Agin
  • 629
  • 1
  • 5
  • 15
0
votes
1 answer

Error during trying opening file in predefined app

I'm trying to open a file directly in the predefined app. I have this code running but I keep getting an error... func pushFile(_ destination: URL) { let appURL = destination DispatchQueue.main.async { if…
Cristian
  • 57
  • 1
  • 8
0
votes
0 answers

viewDidLayoutSubviews & UIApplicationDidBecomeActive notification

In my viewDidLoad, I add code to follow UIApplication.didBecomeActive notification as follows: NotificationCenter.default.addObserver(self, selector: #selector(ViewController.applicationDidBecomeActive), …
0
votes
1 answer

UIApplication.shared.open , swift completion of a connection handling

The below code is used to open a face time and establish a connection, but how to do a certain operation once the call is ended, the "completionHandler" is used only to know if the connection is establised or not UIApplication.shared.open(url,…
Ramu
  • 11
  • 5
0
votes
3 answers

Open a new mainscreen within a mainscreen in blackberry

I'm making an application in which there are few tabs on each tab click a url is called and an online xml is parsed. The data from this xml is displayed. The problem is that when the data is dispalyed the tabs disappear and only appear when i press…
ReNa
  • 1,114
  • 6
  • 19
  • 37
0
votes
1 answer

Calling UIApplication subclass method to start scheduledTimer

I am using Xcode 9.2/iOS 10 and Swift to detect user inactivity in iOS applications using information based on an excellent tutorial example from https://blog.gaelfoppolo.com/detecting-user-inactivity-in-ios-application-684b0eeeef5b The…
0
votes
1 answer

UIApplication keyWindow behavior changed

After upgrading from Xcode 10.3.1 to Xcode 11.1 my custom Activity indicator added over all UIView is gone. It is added to keyWindow like this: UIApplication.shared.keyWindow!.addSubview(PKHUD.sharedHUD) And now it's gone below over other UIView:
Federico Malagoni
  • 722
  • 1
  • 7
  • 21
0
votes
0 answers

Why a URL cannot open in swift?

I am trying experiment to open a url, the usual way, in a swift app. But this time it is not working. Maybe my url has something special. Anyway, this is the URL I…
Michel
  • 10,303
  • 17
  • 82
  • 179
0
votes
2 answers

How to dim status bar in iOS 13

I have been working on an iOS app that, before iOS 13, was able to 'darken" the status bar when a pop-up appeared. This was simply done by adding a view with bounds the as the status bar and applying a .5 alpha to it: lazy var fadeStatusBar: UIView…
PennyWise
  • 595
  • 2
  • 12
  • 37
0
votes
1 answer

Background blackberry UI Application

I am creating a blackberry application that get settings for the first time, and always runs in the background (run on startup). So, whenever I click on the application icon, it does not show any screen if the settings is already configured. I used…
udhaya
  • 1
  • 1
0
votes
3 answers

How to access filed on the screen using Screen Object ( UiApplication.getUiApplication().getActiveScreen())

My Query is How to access Fields on the stacked screen using Screen Object ? The exact problem is as follows: I have one screen which has one text field (ClientName) when user clicks on that field , application will then push a new screen and it…
MrPandav
  • 1,831
  • 1
  • 20
  • 24
0
votes
1 answer

trouble pushing screen on Blackberry UIapplication based on the data in sqlite database

I am trying to push the screen on may main UiApplication (MyApp) based on the either database is created or not and if its created than is it emapty or is it having some data.. but when i run this code my balckberry application jsts hangs .. any…
MrPandav
  • 1,831
  • 1
  • 20
  • 24
0
votes
2 answers

How to get phone number URL from string with random text and a phone number inside

In my iOS application, I have a bunch of alertController messages containing text and one embedded phone number, and I wanted to offer the user the possibility from making the call from an alerControllerAction, and for that I need to be able to…
0
votes
0 answers

How to stop closing the iOS app when click on Home Button while playing a video in AVPlayerViewController

Hi in my application i am playing one Video and when its playing if user click on HomeButton app should not minimise.Is there any way to achieve this and will it create any issues for APP Approval? I try to make app Active inside…
0
votes
1 answer

UIApplication.shared.applicationIconBadgeNumber is laggy

I'm building an iOS app, and I noticed something odd - sometimes, the line of code let someVariable = UIApplication.shared.applicationIconBadgeNumber is extremely laggy (taking on the order of seconds to complete), and sometimes it is not. Is there…
rma
  • 1,853
  • 1
  • 22
  • 42