appdelegate

When App Delegate's method willTerminate is executed?

☆樱花仙子☆ 提交于 2019-12-02 04:37:11
currently I am testing AppDelegate methods, when they are executed by adding NSLog to every method. What is not clear to me is when method applicationWillTerminate is executed? I've tried to put app in background, then to terminate it, but log from Terminate method is not executed. What is executed is this: 2015-09-01 16:24:01.512 TestQuestions[2351:110179] didFinisLaunching 2015-09-01 16:24:02.530 TestQuestions[2351:110179] didBecomeActive 2015-09-01 16:24:05.864 TestQuestions[2351:110179] willResign 2015-09-01 16:24:06.322 TestQuestions[2351:110179] didEnterBackground What is not clear to me

Use AppDelegate in today extension

旧街凉风 提交于 2019-12-01 20:05:46
I'm trying to build an today extension for my app. I'm using CoreData and NSFetchedResultsController and get the following error: Use of undeclared type 'AppDelegate' In this line of code: var appDel: AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate. Does someone know how to solve this error / use AppDelegate in the today extension and would like to help me? A Today Extension isn't an application, so UIApplication and AppDelegate aren't available. I'm not for sure what you are trying to do with the AppDelegate, but extensions do have a NSExtensionContext available by

application openURL in Swift

大憨熊 提交于 2019-12-01 18:01:23
I am having an issue with the Appdelegate method OpenURL. I have setup my Imported UTI's and Document Type. But when opening my app from a mail attachment, the app crashes immediately when I have the method implemented. The depreciated handleOpenURL works, but not OpenURL? At the moment I have no code in the implementation, and am just returning true. func application(application: UIApplication, openURL url: NSURL, sourceApplication: String, annotation: AnyObject?) -> Bool { return true } The crash says Thread 1: EXC_BAD_ACCESS (code-1, address-0x0) I don't really want to have to use the

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

。_饼干妹妹 提交于 2019-12-01 16:15:43
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, when come back on the app code don't enter on this function : -(void)signIn:(GIDSignIn *) signIn didSignInForUser:(GIDGoogleUser *) user withError:(NSError *) error Anyone can help me i can't use another function for login i must call [[GIDSignIn sharedIstance] signIn] and this function detect if another google app is installed and automatically open

loading url from scheme not processing first time - appdelegate vs viewcontroller

旧街凉风 提交于 2019-12-01 13:30:46
问题 My app is successfully opening and setting the parameters (from URL-scheme i.e. myApp://sometextToPrint) to a variable in the AppDelegate class but whenever I want to process them it fails at the first time when the app is opened from that URL. I have the app in foreground checker that calls the function for printing the parameters given, but somehow it looks like the AppDelegate is loaded later than the view why the view fails to print the parameters at first load. My code looks as follow:

actions and categories don't show in UILocalNotification in iOS

旧街凉风 提交于 2019-12-01 06:37:29
I have the following which I believe from the apple documentation here is all I need to have a category for UILocalNotification : - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIMutableUserNotificationAction *acceptAction = [[UIMutableUserNotificationAction alloc] init]; // Define an ID string to be passed back to your app when you handle the action acceptAction.identifier = @"ACCEPT_IDENTIFIER"; // Localized string displayed in the action button acceptAction.title = @"Accept"; // If you need to show UI, choose foreground

actions and categories don't show in UILocalNotification in iOS

一个人想着一个人 提交于 2019-12-01 04:53:03
问题 I have the following which I believe from the apple documentation here is all I need to have a category for UILocalNotification : - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIMutableUserNotificationAction *acceptAction = [[UIMutableUserNotificationAction alloc] init]; // Define an ID string to be passed back to your app when you handle the action acceptAction.identifier = @"ACCEPT_IDENTIFIER"; // Localized string displayed in

iOS self.window - when is it created?

梦想的初衷 提交于 2019-12-01 01:47:07
问题 when you start your app using single view template, and you add the NSLog(@"self.window = %@", self.window); in your first line of the AppDelegate.m's application: didFinishLaunchingWithOptions: method, you can see that self.window exists in your app. However, when you start your app using empty template, and tried to log the self.window to the console, the result returns null . Even if you add storyboard and a view controller, and set its view controller as the initial view controller, and

game exits from pause state after resuming it from background in swift

只谈情不闲聊 提交于 2019-12-01 00:27:29
I'm developing a game with SpriteKit that can be paused during execution and can be resumed. But I have a problem with applicationDidEnterBackground when the home button is pressed while the game is paused because when I resume the game the entities start moving immediately even though the game was paused before. I cannot find a way to implement applicationDidEnterBackground and other related method in AppDelegate since there is no connection between that and my GameScene.swift I'm actually pausing the entities with the code entitiesLayerNode.paused = true gameState = .GamePaused EDIT: I want

How to detect all touches in Swift 2

a 夏天 提交于 2019-11-30 21:26:18
I'm trying to create a timeout function for an app I'm develop using Swift 2 but in swift 2, you can put this code in the app delegate and it works but it does not detect any keyboard presses, button presses, textfield presses, and etc: override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { super.touchesBegan(touches, withEvent: event); let allTouches = event!.allTouches(); if(allTouches?.count > 0) { let phase = (allTouches!.first as UITouch!).phase; if(phase == UITouchPhase.Began || phase == UITouchPhase.Ended) { //Stuff timeoutModel.actionPerformed(); } } } Before