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

NSXMLParser results are null when not initialized in app delegate

Why does initializing a parser... in a TVC instead of the app delegate writing the parsed values directly to the parser delegate, declared in .h: @interface TVC:UITableViewController{ NSMutableArray *parsedDataArray; } @property (nonatomic, weak)…
Morkrom
  • 578
  • 7
  • 26
0
votes
1 answer

UIApplication prevent app moving to foreground if other app calls openURL: with valid URL

Can we prevent application moving to foreground if other apps call openURL: with valid URL. I need only save data from URL; caller application should stay in foreground and receiver app should stay in background. For example: first app calls to…
0
votes
1 answer

"Application windows are expected to have a root view controller at the end of application launch" occurred after I disable storyboard

I disabled storyboard by change the Main Storyboard to nothing. And I have rewrite everything so I don't need a storyboard and it working correctly. But in the console log, Application windows are expected to have a root view controller at the end…
yong ho
  • 3,892
  • 9
  • 40
  • 81
0
votes
1 answer

Wanting to Push to UIViewContoller, from UIViewController via openURL and custom URL navigation

I'm currently working on an application that requires a new view to be pushed to when the user clicks on a URL (This new view contains a UIWebView with browser functions). I've got this working perfectly from UIWebViews within the application, I'm…
davidford.me
  • 824
  • 1
  • 15
  • 24
0
votes
1 answer

How does main.m works in iOS?

int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; return retVal; } will UIApplicationMain() call will return only after…
Rooban Ponraj A
  • 281
  • 4
  • 20
0
votes
1 answer

UIApplication get name of app which will handle URL

Is it possible to retrieve the name of the app which will handle a specific URL? In other apps I saw "Open Link in Safari" and if you click, YouTube or whatever else will launch. I don't really like this behavior and I'd like the get the…
Julian F. Weinert
  • 7,474
  • 7
  • 59
  • 107
0
votes
1 answer

UIApplication openURL - get rid of %0A

Issue: I'm parsing some info from an xml file (RSS feed) into a feed reader I'm developing. When trying opening news URL with Safari [[UIApplication sharedApplication] openURL:url] is not working. I suspect the xml file itself is not well prepared.…
Daemon Painter
  • 3,208
  • 3
  • 29
  • 44
0
votes
3 answers

AppDelegate not being called on iOS / Allegro 5

-- I have this in my appdelegate.m among all the other default calls: -- @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc]…
0
votes
1 answer

UITableViewCell get UITabBarController

I have got an UITableViewCell and I want to call a void in a ViewController of the UITabBar in it. Is that possible using [UIApplication sharedApplication]? If yes, how can I do that? Thanks in advance.
0
votes
1 answer

ios app hits straight shouldstartloadwithrequest after coming from background instead

I have a webview in my mainviewcontroller and i am laoding a webpage in viewdidload method as below: - (void)viewDidLoad { [super viewDidLoad]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [_loginWebView…
Jatin
  • 1,668
  • 2
  • 16
  • 23
0
votes
1 answer

Facebook button going to facebook iPhone app, but not loading correct facebook page

Possible Duplicate: Custom URL scheme for new Facebook iOS app I have a Facebook button in my iPhone app. When it gets touched I want it to go to the Facebook iPhone app and load a facebook page if the Facebook iPhone app is on the device, if…
SirRupertIII
  • 12,324
  • 20
  • 72
  • 121
0
votes
2 answers

delete files in documents folder when iphone app terminated

My iPhone app will download several content to Documents folder while running the application. I want to delete the downloaded files when app is going to terminate. My app runs on target 4.3 or more and ARC enabled. What is the best place to delete…
0
votes
1 answer

How to present a modal view controller outside of a view controller using presentModalViewController:animated?

Let's say you have an application in which you know for sure that there's always a UINavigationController displayed, and that I need to display another view controller modally from outside this controller (for example : because I use the Command…
David
  • 998
  • 7
  • 17
0
votes
1 answer

write to database when ios app in background state

When iPhone app is in background state or when app is minimized, I want to monitor the duration of time the app is in background and on every regular interval like every 24hrs need to get updates from web server and write the modifications in my…
0
votes
1 answer

iOS application runs after end of background task

I made custom voip application. Almost everything works nice; but time from time application is restarted. From crash log: Exception Type: 00000020 Exception Codes: 0xbad22222 Highlighted Thread: 4 SBUnsuspendLimit CryptTalkDev[24820] exceeded 15…
Dmytro
  • 530
  • 4
  • 18