appdelegate

UIStatusBarStyle not working in Swift

拥有回忆 提交于 2019-11-29 18:58:58
I'm trying to change the Status Bar color in my Swift app to white, but am hitting a brick wall. I have 3 ViewControllers that are each embedded in a NavigationController (could that be the issue? I've already tried to place the code in the NavigationController class.) I've tried both of the following pieces of code in the didFinishLaunchingWithOptions of my AppDelegate.swift file but neither worked. application.statusBarStyle = .LightContent and UIApplication.sharedApplication().statusBarStyle = .LightContent All that the Docs have to say about it is that UIBarButtonStyle is an Int and gave

Change initial view controller after first launch of app

久未见 提交于 2019-11-29 16:46:12
I have a two-view login to my app where a user enters two views worth of info. After the user has entered that info I want change which view is the initial view controller, and have the login view be a settings-like page. How can I change the initial view controller after the user has passed a certain point in the app? For one of my apps, where I did similar to this, I have my "main" view controller check on viewDidLoad for a setting in the default settings that would indicate if the user had signed in. If they hadn't, I immediately pushed the loginViewController without animation and the user

How to use the device token in method other than didRegisterForRemoteNotificationsWithDeviceToken?

丶灬走出姿态 提交于 2019-11-29 16:31:30
I got the device token through didRegisterForRemoteNotificationsWithDeviceToken method. I wanted to use the device token in another method. I tried it in this way, In didRegisterForRemoteNotificationsWithDeviceToken method: str = [NSString stringWithFormat:@"%@",deviceToken]; // str is the NSString which is declared in the appDelegate.h file as global variable In didReceiveRemoteNotification method: NSLog(@"Device Token : %@",str); When i do like this the Device Token is returning as "nosniff". How can i store this device token in a global variable and use it in the other class or in other

Open a ViewController from remote notification

混江龙づ霸主 提交于 2019-11-29 14:01:18
问题 I try to open a particular ViewController when my app catch a remote notification. Let me show my project's architecture. Here my storyboard : When I receive a notification I want open a "SimplePostViewController", so this is my appDelegate : var window: UIWindow? var navigationVC: UINavigationController? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { let notificationTypes: UIUserNotificationType =

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

前提是你 提交于 2019-11-29 13:35:13
问题 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 code can be added to the PhoneGap project's AppDelegate.m file as shown on this page. I've located the AppDelegate.m file but can't seem to figure out how to set the keyboard appearance to that of UIKeyboardAppearanceAlert on all textfields . Code

swift ios - How to run function in ViewController from AppDelegate

风流意气都作罢 提交于 2019-11-29 11:22:47
I am trying to run a function in certain ViewController using AppDelegate func applicationDidBecomeActive(_ application: UIApplication) { ViewController().grabData() } But somehow the function does not seem to run at all when the app has become active after entering the app from the background. The function looks like this func grabData() { self._DATASERVICE_GET_STATS(completion: { (int) -> () in if int == 0 { print("Nothing") } else { print(int) for (_, data) in self.userDataArray.enumerated() { let number = Double(data["wage"]!) let x = number!/3600 let z = Double(x * Double(int)) self.money

Life cycle of app - when app is in terminated and push kit payload comes

女生的网名这么多〃 提交于 2019-11-29 04:11:17
问题 What would be life cycle of app? when app is in terminated state and push kit payload comes. First of all Pushkit delegate methods will work or AppDelegate methods will work. Can someone describe sequence of methods getting called in such scenario? Appreciate your answer. Thanks in advance. 回答1: Life cycle of app - when app is in terminated and push kit payload comes When you receive a push payload then application became active for 20-30 second in terminate state then call following method.

Why is AppDelegate.swift window an optional?

有些话、适合烂在心里 提交于 2019-11-29 01:43:08
I was reading Apple docs , when I found this sentence: The AppDelegate class contains a single property: window . var window: UIWindow? This property stores a reference to the app’s window. This window represents the root of your app’s view hierarchy. It is where all of your app content is drawn. Note that the window property is an optional , which means it may have no value (be nil ) at some point. What I don't understand is: why this property at some point could be nil? What's the case for it to be(come) nil? When you close your application, your app can still receive silentNotifications or

Swift - pushViewController from appDelegate, rootViewController.navigationController is nil

房东的猫 提交于 2019-11-28 19:20:29
Having a problem following a few guides, specifically http://blog.originate.com/blog/2014/04/22/deeplinking-in-ios/ I'm setting the url scheme and it's working well to launch the app from another app, but passing in the host or url are not working as it seems it should. I'm using storyboards and interface builder for all the view layouts. The guide shows this openURL in appDelegate: -(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{ if([[url host] isEqualToString:@"page"]){ if([[url path]

When do the appdelegate methods get called in relation to the view lifecycle methods of your initial view controller? [closed]

白昼怎懂夜的黑 提交于 2019-11-28 18:03:02
What is the sequence of methods that get called when your app loads, especially for these methods: applicationDidFinishLaunching viewDidLoad viewWillAppear applicationDidBecomeActive awakeFromNib U could checkout this site http://www.cocoanetics.com/2010/07/understanding-ios-4-backgrounding-and-delegate-messaging/ & this flow chart of application. and check out this flow chart.... 来源: https://stackoverflow.com/questions/17498568/when-do-the-appdelegate-methods-get-called-in-relation-to-the-view-lifecycle-met