appdelegate

XCode Templates: moving AppDelegate

↘锁芯ラ 提交于 2019-12-24 00:10:15
问题 I am currently working on some XCode templates to make my work easier. I copied the original templates and modified them to my needs. Until now, everything worked just fine. However, i can't find a way to move the generated AppDelegate files to a subfolder without ending up with two copies of them. Does enybody know how to move the AppDelegate to a subfolder? Which template do i have to modify? Thanks in advance! Chris 回答1: I just managed to move all files as intended. It is important to make

Push notifications disappear if received while app not running

故事扮演 提交于 2019-12-23 16:28:07
问题 I'm developing an app that can receive push notifications which, in some circumstances, trigger background fetch operations. Therefore, I've enabled the remote-notification background capability for my app. When the app is suspended, push notifications cause the app to wake up and execute application:didReceiveRemoteNotification:fetchCompletionHandler , the banner appears on the homescreen, and the notification remains in the Notification Center until the user taps it to launch the app. It

How to access applicationDidEnterBackground from viewController

心不动则不痛 提交于 2019-12-23 14:24:17
问题 How can I call applicationDidEnterBackground that in AppDelegate from a viewController ? I want to run a function in the background of the app without pressing home button. 回答1: You are not supposed to call that function from anywhere. It is there to let you know when the app enters the background. Do you simply want to know when the app enters the background? If so, then you can create a notification to help you with that: [[NSNotificationCenter defaultCenter] addObserver: self selector:

How to access applicationDidEnterBackground from viewController

左心房为你撑大大i 提交于 2019-12-23 14:24:09
问题 How can I call applicationDidEnterBackground that in AppDelegate from a viewController ? I want to run a function in the background of the app without pressing home button. 回答1: You are not supposed to call that function from anywhere. It is there to let you know when the app enters the background. Do you simply want to know when the app enters the background? If so, then you can create a notification to help you with that: [[NSNotificationCenter defaultCenter] addObserver: self selector:

Either AppDelgate is called or ViewController is

别说谁变了你拦得住时间么 提交于 2019-12-23 04:40:21
问题 I am wanting both my AppDelegate and my ViewController to be called on startup (as expected). When only the ViewController is called: main.c int main(int argc, const char * argv[]) { return NSApplicationMain(argc, argv); } When the AppDelegate is called and the view controller is not. main.c #import "AppDelegate.h" int main(int argc, const char *argv[]) { NSArray *tl; NSApplication *application = [NSApplication sharedApplication]; [[NSBundle mainBundle] loadNibNamed:@"ViewController" owner

Aassigning a value to a view controller from AppDelegate.swift

。_饼干妹妹 提交于 2019-12-22 12:24:27
问题 I try to assign a value to a view controller from AppDelegate.swift without success. My controller is named DestinationsViewController , and its id in Main.storyboard is destinationsID . DestinationsController is embed in a Navigation Controller. The objet I want to change is named "label". This is the code: if let destinationsViewController = storyBoard.instantiateViewControllerWithIdentifier("destinationsID") as? DestinationsViewController { if let label = destinationsViewController.label{

How to hold splashscreen until process in app delegate is over?

五迷三道 提交于 2019-12-22 10:28:32
问题 In app delegate I put some func, I want the splashscreen waiting till the appdelegate finished its func. Now, my app immediately run initial view controller func and app delegate func together. func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. let email = NSUserDefaults.standardUserDefaults().stringForKey("userEmail") if let email = email { reLogin() }else{

supportedInterfaceOrientationsForWindow in Swift 2.0

筅森魡賤 提交于 2019-12-22 09:37:02
问题 func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask { return UIInterfaceOrientationMask.Portrait.rawValue.hashValue | UIInterfaceOrientationMask.PortraitUpsideDown.rawValue.hashValue } That used to work in Swift 1.2 however the return line is now throwing this error: Binary operator '|' cannot be applied to two 'UIInterfaceOrientationMask' operands I am able to get to work with just 1 return value with the new

iPhone Objective-c detect Screen Lock

岁酱吖の 提交于 2019-12-22 06:37:20
问题 I'm new to make iPhone App with Objective-c I want to make the App which sends a notification when iPhone screen is locked(Pressed Lock button) How can I make this app? I'm trying to make it using "applicationWillSuspend", but /*----------------------------------------*/ - (void)applicationWillSuspend { NSLog(@"WillSuspend"); } /*----------------------------------------*/ This code doesn't work I'm not sure when applicationWillSuspend is called Please, give me some knowledge #import

Passing data back and forth using AppDelegate

依然范特西╮ 提交于 2019-12-22 01:24:53
问题 To start I am building an app to learn the basics of Objective-C. If there is anything unclear please let me know and I will edit my question. The app is supposed to have the next functionality. Open the camera preview when the app is executed. On the top there is a button to go to a TemplateController where the user can select an array of frames to select from a UICollectionView. User selects the Template and returns to the Camera Preview. User takes a picture and the picture with the frame