appdelegate

Handling different URL Schemes in iOS (Facebook and Instagram)

梦想的初衷 提交于 2019-11-30 20:36:54
I am not even sure how to define the problem but here it goes. I have an application that uses Facebook SDK for user login. I followed the Facebook authorization tutorial. I am not 100% sure how it works but this part in my "AppDelegate.m" seems important. - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { return [FBSession.activeSession handleOpenURL:url]; } So far so good. Now I want to implement a similar login for instagram so that the user can access their photos. I run this example without a

Pausing timer when app is in background state Swift

廉价感情. 提交于 2019-11-30 19:51:48
My ViewController.swift func startTimer() { timer = NSTimer().scheduleTimerWithTimerInvterval(1.0,target: self,selctor: Selector("couting"),userinfo: nil, repeats: true) } func pauseTimer() { timer.invalidate() println("pausing timer") } and this is appDelegate.swift func applicateWillResignActive(application: UIApplication) { viewController().pauseTimer() println("closing app") } It is printing pausing timer and closing app but when I open again I see it never paused. How do I do it correctly? You have to set an observer listening to when the application did enter background. Add the below

The app delegate must implement the window property if it wants to use a main storyboard file

眉间皱痕 提交于 2019-11-30 17:56:24
I'm programmatically implement a list view controller. When I try to run the project, I got error: 2012-11-07 22:46:34.719 myTableViewControl[12021:c07] The app delegate must implement the window property if it wants to use a main storyboard file. 2012-11-07 22:46:34.722 myTableViewControl[12021:c07] -[AppDelegate setWindow:]: unrecognized selector sent to instance 0x7674e70 2012-11-07 22:46:34.723 myTableViewControl[12021:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate setWindow:]: unrecognized selector sent to instance 0x7674e70' ***

Call app delegate method from view controller

て烟熏妆下的殇ゞ 提交于 2019-11-30 17:48:15
I want to know if I can call an app delegate method from another ViewController. When the app starts, the application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool i method is called. Can I call this method a second time from another view controller? Not sure why you want to do this. You probably shouldn't, but for the purpose of answering the question here it is: // get a reference to the app delegate let appDelegate: AppDelegate? = UIApplication.shared.delegate as? AppDelegate // call didFinishLaunchWithOptions ... why? appDelegate?

Programmatically set rootViewcontroller for UINavigationcontroller in Storyboard in Appdelegate

泪湿孤枕 提交于 2019-11-30 13:56:13
问题 I have a value in NSUserdefaults . I am using storyboard , it is embedded in UINavigationController . - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if([[NSUserDefaults standardUserDefaults]objectForKey:@"isLoggedIn"]){ //show home page here }else{ // show login view } } I can open the app using a URL also - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { NSString *text = [[url host]

Open a ViewController from remote notification

女生的网名这么多〃 提交于 2019-11-30 13:23:31
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 = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound] let pushNotificationSettings =

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

◇◆丶佛笑我妖孽 提交于 2019-11-30 09:31:09
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 example provided by the answerer: mytextfield.keyboardAppearance = UIKeyboardAppearanceAlert; Writing an

Programmatically set rootViewcontroller for UINavigationcontroller in Storyboard in Appdelegate

血红的双手。 提交于 2019-11-30 09:09:52
I have a value in NSUserdefaults . I am using storyboard , it is embedded in UINavigationController . - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if([[NSUserDefaults standardUserDefaults]objectForKey:@"isLoggedIn"]){ //show home page here }else{ // show login view } } I can open the app using a URL also - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { NSString *text = [[url host] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; if(text.length > 0){ // show home page }else { //

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

空扰寡人 提交于 2019-11-30 05:31:33
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. 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. didFinishLaunchingWithOptions (Here perform some intilization operation intiliaze window and

The app delegate must implement the window property if it wants to use a main storyboard file

妖精的绣舞 提交于 2019-11-30 01:29:51
问题 I'm programmatically implement a list view controller. When I try to run the project, I got error: 2012-11-07 22:46:34.719 myTableViewControl[12021:c07] The app delegate must implement the window property if it wants to use a main storyboard file. 2012-11-07 22:46:34.722 myTableViewControl[12021:c07] -[AppDelegate setWindow:]: unrecognized selector sent to instance 0x7674e70 2012-11-07 22:46:34.723 myTableViewControl[12021:c07] *** Terminating app due to uncaught exception