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
1
vote
2 answers

UIApplicationState active in background on iOS 7

I setup a background task with beginBackgroundTaskWithExpirationHandler:^{ } and even after ending the task using if ([[UIDevice currentDevice] isMultitaskingSupported]) { [[UIApplication sharedApplication]…
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
1
vote
1 answer

Upload image from ios application to server

I am working on one application in which i want to save image directly on the server path. I am using below code for it but it is not saving image on that path. Response from server is coming NUll and not savig image in server path NSData *imageData…
user2902101
  • 493
  • 1
  • 9
  • 17
1
vote
2 answers

iOS >> Local Notifications >> Add to Application BadgeNumber While App is in Background

In my app I have objects that trigger Local Notifications. When the app is in the background the Local Notifications are fired when it's their time to be fired, and that works fine. For some reason, the Badge Number is not updated. When setting the…
Ohad Regev
  • 5,641
  • 12
  • 60
  • 84
1
vote
4 answers

doesn't return windows

I need to add a view to window on iPhone, so i tried to do this: [[UIApplication sharedApplication] windows], but it seams that the array contains only one window. Can anyone tell me what i'm not doing write/what i need to do?
mxg
  • 20,946
  • 12
  • 59
  • 80
1
vote
1 answer

Youtube App on iPhone ignoring private videos

I seem to have noticed an odd bug in the YouTube App with the iPhone. I have written a small program that fires off the YouTube app with a url like: http://www.youtube.com/watch?v=adsakasjda This video is a private video held on youtube. When the…
Oni
  • 652
  • 2
  • 9
  • 22
1
vote
1 answer

Not moving to Settings in iPod Touch

I have a button . When I click on it I have used this code to go to settings in the iPod Touch . But it is not going . iPod touch iOS is 6.1 . Please tell me the problem. Thanks in advance . For reference I have attached the settings screen…
user247
  • 416
  • 3
  • 14
1
vote
2 answers

How can I pass a "property-list" object to an iOS Application via Custom URL?

iOS Gurus, I'm creating an iOS application that will respond to Custom URLs. When reading the documentation for handling a custom URL (API doc here: application:openURL:sourceApplication:annotation:), I see that the 4th argument is an annotation,…
John Fowler
  • 3,173
  • 3
  • 18
  • 31
1
vote
1 answer

how to link static cells to Outlet/Actions - E.G tap the call cell to call the number

The code I have. By the way, I can't get Call to work and Website does not open either! - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *urlToOpen = @""; if( indexPath.section == 0 ){ //…
holtii
  • 165
  • 2
  • 12
1
vote
1 answer

How to disable popup menu items like Select, Select All, Suggest..., Define (on UIWebView)?

How to disable popup menu items like Select, Select All, Suggest..., Define (on UIWebView)? I have found the following information on the help but don't understand how to use it: For the editing menu commands, this is the shared UIApplication …
Dmitry
  • 14,306
  • 23
  • 105
  • 189
1
vote
1 answer

How to apply landscape mode for Game Center View Controller in iOS6

I am working with COCOS2D game. Now i have updated my game to iOS6. I have seen that Apple has changed Game Center login(authentication) process. So for that i have used handler authenticateWithCompletionHandler and nw my game is crashing. I have…
Nirav Jain
  • 5,088
  • 5
  • 40
  • 61
1
vote
1 answer

where an internal dispatch table. in addTarget:action:forControlEvents:

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIControl_Class/Reference/Reference.html#//apple_ref/occ/cl/UIControl addTarget:action:forControlEvents: Adds a target and action for a particular event (or events) to an internal…
user1292717
  • 173
  • 10
1
vote
1 answer

How to start another apps when click a button?

I want to start another apps when I click this button. sharebtn = new Custom_ButtonField(share, shareactive, shareactive) { protected boolean navigationClick(int status, int time) { //I want to start another apps…
Alan Lai
  • 1,296
  • 2
  • 12
  • 16
1
vote
1 answer

Call phone number from UIButton

I've searched through all the questions and can't seem to find my answer. I have the following IBAction. This is crashing every time you tap on the phone number. I have gone back to the DB and formatted the phone numbers to 5551235555 instead of…
1
vote
2 answers

iPhone - Application exit on suspend

I have an iPhone application in which I would like to give the user the option of turning a setting on/off depending on wether or not they would like the application to exit when suspended (or going into the background). As I understand it, there is…
Jack Nutkins
  • 1,555
  • 5
  • 36
  • 71
1
vote
1 answer

Managing view hierarchy when opening a document

I have an IOS App that can open a specific type of documents. My App receives the document through: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions when it was not yet started or through…
sebastien
  • 2,489
  • 5
  • 26
  • 47