appdelegate

Swift 3 present view from appdelget when application was off

断了今生、忘了曾经 提交于 2019-12-25 18:36:26
问题 when the user opening the push notification i present view from appdelget by this code func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { application.applicationIconBadgeNumber = 0; // Clear badge when app is launched if UserDefaults.standard.bool(forKey: "PushOFF") == false { registerForRemoteNotification() } else { UIApplication.shared.unregisterForRemoteNotifications() } return true } func

iOS: How can I send an email automatically with an iPad in sleep mode every hours during X hours?

人盡茶涼 提交于 2019-12-25 08:47:32
问题 I have a way to send email that works perfectly, but I would like to send it automatically, even if the iPad is in sleep mode. The way to send email is here: How can I send an email with attachement using the API MailJet in iOS programmatically? Thanks in advance. 回答1: Background tasks like this are not easy to accomplish in iOS, Apple places obstacles in our way to prevent us doing so. As Apple don't want us doing this, you should ask yourself why you need to do it. Do you intend to publish

WatchOS 2 not reading NSData from iPhone AppDelegate

南楼画角 提交于 2019-12-25 06:44:45
问题 I need help or an extra eye to find out why my query and methods aren't returning data to the Apple Watch. I am trying to populate my table with images that have PFFiles stored in my parse database. When my messages require a String back, they are going through, but not when I'm requesting NSData back. I am having to ask for an NSData file back because the Watch does not conform to parse protocols, I've learned. So I am trying to convert them on the AppDelegate side, then transfer as NSData.

Get applicationDidFinishLaunching call in a View Controller. Parse not initialized yet

青春壹個敷衍的年華 提交于 2019-12-25 06:39:41
问题 I am trying to load data from Parse in my Initial View Controller . The issue is that Parse is initialized in my AppDelegate 's didFinishLaunching so I need to wait until it is called before I attempt to load the data from Parse. What is the best way to get this notification in my view controller? Or would it be better to get the data in my AppDelegate ? All help is appreciated! 回答1: You can add an observer for the UIApplicationDidFinishLaunchingNotification inside your view controller

Referring to NSPersistentStore instances created in AppDelegate

丶灬走出姿态 提交于 2019-12-25 04:27:07
问题 I modified the boilerplate core data stack code you get with a core data application to add two NSPersistentStore s to the NSPersistentStoreCoordinator instead of just one. // MARK: - Core Data stack lazy var applicationDocumentsDirectory: NSURL = { let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask) return urls[urls.count-1] as NSURL }() lazy var managedObjectModel: NSManagedObjectModel = { let modelURL = NSBundle.mainBundle()

How to receive iOS notifications in background without user interaction

纵然是瞬间 提交于 2019-12-24 21:33:36
问题 I have use following methods to receive notifications in AppDelegate . When user is on foreground notification receives as expected. But if user is on background notification will receive(in AppDelegate) notification only if user tapped a popup. How to receive notification without involving user tap when app running on background. - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)

Get title of selected tab in UITabBarController

ⅰ亾dé卋堺 提交于 2019-12-24 17:17:14
问题 I have set the title for all five of my tabs in my AppDelegate file. I would like to access that title in another view within my application. I have the code below to output to the log window the selected index of that selected tab but what I'd really like to get is the title for that tab. I did have a look through the UITabBarController Class Reference and I didn't see anything that would allow me to do this. What I am trying to avoid is some sort of switch or if...else statement where I

want to call ViewController's method from appdelegate

谁说胖子不能爱 提交于 2019-12-24 10:40:01
问题 I want to call ViewController 's method in AppDelegate.m. i have method method() in my Viewcontroller .i want it to be called when didSelectMethod() called in appdelegate.m . I have called method like this.- ViewController *vc=[[ViewController alloc]init]; [vc method]; method is called but not having same instance as actually method having. it having all nill values. can anyone give me right code for this what i want. Thank you Jagveer Rana 回答1: While this has been correctly answered for the

Call GameScene method from AppDelegate (Swift 3, SpriteKit, Xcode 8)

与世无争的帅哥 提交于 2019-12-24 06:48:56
问题 I am using Spritekit and swift 3 for create a game, my problem is when I try to call my pauseGame() method, present in my GameScene class (subclass of SKScene), from AppDelegate file within applicationWillResignActive(_ application: UIApplication) method. I already try to instantiate GameScene class and then call the method in my AppDelegate file in this way, although there is no compiler error it doesn't work: func applicationWillResignActive(_ application: UIApplication) { if let gameScene

Singleton vs. third-party libraries

落爺英雄遲暮 提交于 2019-12-24 01:28:07
问题 I'm familiar with the concept of Singleton and this mechanism is pretty handy but.. What happens in case I want one, shared instance of some third-party class e.g. AFHTTPRequestOperation or maybe some Magical Record? What should I do when I'm using one object from external class in many controllers? Or maybe it is a good practice to instantiate a new object in each controller? 回答1: I'm not familiar with Magical Record but for AFNewtorking it definitely makes sense to make a singleton in many