Questions tagged [appdelegate]

In iOS, the app delegate is responsible for managing the app throughout its lifecycle by responding to events such as launch and termination.

2019 questions
9
votes
3 answers

Alter keyboard appearance in native, phonegap/Cordova built iOS App

I want to change the background color of all the keyboards appearing in my Phonegap/Cordova built native iOS App as shown below: I have googled this thoroughly of course and found mainly 2 relevant answers. The answerer here says that Objective-C…
Jonathan
  • 2,953
  • 3
  • 26
  • 37
8
votes
1 answer

iOS 15 app not launching in killed state with location change

I have added the background modes for location in my app SS here But still, the app does not launch with the launch options key UIApplication.LaunchOptionsKey.location Here is my app delegate code, func application(_ application: UIApplication,…
nil
  • 113
  • 4
8
votes
3 answers

Can I make an api call when the user terminates the app?

I need to make an API call when the user terminates the app (force close). The straight forward implementation I did is as below. In the app delegate, I added the following code. func applicationWillTerminate(_ application: UIApplication) { …
Sujal
  • 1,447
  • 19
  • 34
8
votes
5 answers

Apply custom UIButton styling to all Buttons

I want to apply some styling to all my viewcontrollers from multiple storyboards. I have many viewcontrollers so applying the styling to every viewcontroller sounds rather silly. I want to do it in the most code lean way as possible. I was thinking…
vandernat.p
  • 153
  • 1
  • 1
  • 10
8
votes
1 answer

How can I open a specific Tab View from AppDelegate

My root view is a tab bar controller, I would like to open the app on a specific tab when a certain notification is received. If I use presentViewController the tab bar disappears. Is there a specific way to do this?
Mr Mike
  • 337
  • 3
  • 12
8
votes
2 answers

Prompting permission for Motion & Fitness data

I want users to be prompted as soon as app launches for permission to access Motion & Fitness data (CoreMotion). Right now I'm trying to do a "dummy" query for the data to prompt the permission on a…
leonsas
  • 4,718
  • 6
  • 43
  • 70
8
votes
4 answers

Not fetch Google user when handle sign in with another Google app using GIDSignIn

I'm using Google Sign-In for iOS and when using simulator it's working fine because no google app is installed and user is fetch, but when using my iPhone 6 device open youtube (with some registered account inside them) for handle sign in. After,…
Ridney
  • 95
  • 5
8
votes
1 answer

how to get appDelegate with Urban AirShip (Swift)

After integrating Urban Airship, when I call let appDelegate = UIApplication.sharedApplication().delegate as? AppDelegate I always get nil. When I tried to get class of UIApplication.sharedApplication().delegate, it tells me, that it is…
krosh
  • 218
  • 4
  • 15
8
votes
5 answers

How does AppDelegate.swift replace AppDelegate.h and AppDelegate.m in Xcode 6.3

According to the iOS Developer Library The app delegate is where you write your custom app-level code. Like all classes, the AppDelegate class is defined in two source code files in your app: in the interface file, AppDelegate.h, and in the…
Mark B
  • 147
  • 2
  • 8
8
votes
1 answer

Background task stopping when device locked?

I have a timer running when the device enters the background as I want to keep a check on a small amount of data in my service. I am using the following code in the applicationDidEnterBackground method in app delegate UIApplication *app =…
Tony Law
  • 293
  • 2
  • 13
8
votes
3 answers

How to handle launchOptions: [NSObject: AnyObject]? in Swift?

In a Swift AppDelegate class, you get the following method: func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // ...code... return true } The launchOptions:…
Dave Gallagher
  • 453
  • 4
  • 6
8
votes
1 answer

NSCache removes all its data when app goes to background State

I am working with NSCache, I am using NSCache to store images. I am showing images on UITableView. Whenever I add images first they are resized and then added to the table and then to NSCache. eveything works fine. But whenever app goes to…
Ranjit
  • 4,576
  • 11
  • 62
  • 121
7
votes
2 answers

How to show NSPopover in SwiftUI lifecycle?

I'm trying to show a detachable NSPopover by clicking on a button but I'm stuck. I followed tuts how to show NSPopover but they all around Menubar apps. My AppDelegate looks like this final class AppDelegate: NSObject, NSApplicationDelegate { …
Roman Banks
  • 319
  • 2
  • 14
7
votes
2 answers

Why doesn't my Swift app have AppDelegate or SceneDelegate?

So I'm new to Swift. I see it's a fast-moving language. But so many tutorials I see have AppDelegate and SceneDelegate as standard init files, why don't I have any? Why can't I seem to find an option for them? The tutorials include one from July…
Maxime Franchot
  • 1,015
  • 1
  • 10
  • 24
7
votes
1 answer

Requests run when my app will enter foreground fail with "The network connection was lost."

My app is getting a fair number of network errors after I start making requests while transitioning from the background to the foreground. The error looks like this: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost."…
Mick F
  • 7,312
  • 6
  • 51
  • 98