ios8-today-widget

Use AppDelegate in today extension

我怕爱的太早我们不能终老 提交于 2019-12-19 21:45:09
问题 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? 回答1: A Today Extension isn't an application, so UIApplication and AppDelegate aren't available. I'm not for sure

Use AppDelegate in today extension

我是研究僧i 提交于 2019-12-19 21:43:06
问题 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? 回答1: A Today Extension isn't an application, so UIApplication and AppDelegate aren't available. I'm not for sure

Height of iOS8 Today Extension using Only Auto Layout Gives Broken Constraints

柔情痞子 提交于 2019-12-17 22:29:52
问题 Apple documentation suggests setting the height of Today Extensions using autolayout. If a widget has additional content to display, you can rely on Auto Layout constraints to adjust the widget’s height as appropriate. If you don’t use Auto Layout, you can use the UIViewController property preferredContentSize to specify the widget’s new height. However, every example and tutorial I have seen ends up using preferredContentSize . All of my attempts to set the height via autolayout lead to

NSUserDefaultsDidChangeNotification and Today Extensions

China☆狼群 提交于 2019-12-17 18:33:07
问题 I am developing an iPhone app with a Today Extension . The app has a Model module that loads from/saves to NSUserDefaults . Since I want this information to be available to both the main app and the extension, I use an app group: let storage = NSUserDefaults(suiteName: "group.etc.etc.etc...") Both the app and the extension can access the information without any problem. The main app occasionally might create a local notification to present to the user. That notification has two actions

Ensuring 'Today' extension has updated information from Core Data

这一生的挚爱 提交于 2019-12-13 00:40:31
问题 I have an application and a today extension that are sharing a Core Data persistent store using a security group identifier. The main app updates the Core Data store and the extension only reads from the store. I am using a NSFetchedResultsController in both the app and the extension to retrieve the objects. This basically works, except that when the main app adds new objects to the store they aren't visible to the extension immediately. Similarly the extension can still see objects after

How to build a Today Widget / App Extension with Cordova?

女生的网名这么多〃 提交于 2019-12-12 03:44:02
问题 An app I am working on needs a Today Extension / Widget. Are there any resources on how to build one into an Cordova app? I found this, but it's not written very clearly and from what I understood seems to be a native app that only uses a HTML5 element in the app and widget to display some data :/ 回答1: Yes you are right, today extension are a native thing. I recently also did a lot of research on how to integrate one into a cordova project dynamically and ended up creating my own cordova

How to frequently update today widget in notification center?

你说的曾经没有我的故事 提交于 2019-12-11 03:13:30
问题 I am finding that my Notification Center widget does not reload very often. Because of this, out of date data being presented. I have not been able to find a way to get the widget to refresh every time I open the Today view. I have seen apps such as NBA Gametime that are able to update every time I pull down to see the widget. How can I get this functionality in my app? 回答1: Based on my own experimentation and also reports in this SO thread, it appears that the TodayViewController.viewDidLoad

Exception when fetching parse.com user data in iOS 8 Today Extension

人走茶凉 提交于 2019-12-10 08:54:21
问题 I am trying to fetch a list of PFObjects of a PFUser to display in the iOS 8 Today Widget. Following this blog post by Parse, I've enabled the same App Groups and Keychain Sharing in both my main app and extension in Xcode. I've also enabled the following in the AppDelegate of my main app and the viewDidLoad of my Today Extension: [Parse enableLocalDatastore]; [Parse enableDataSharingWithApplicationGroupIdentifier:@"group.com.me.myapp" containingApplication:@"com.me.myapp"]; [Parse

Is it possible to refresh a timer in a Today Widget?

回眸只為那壹抹淺笑 提交于 2019-12-09 12:48:30
问题 I was wondering is it possible to update the text label of a timer in a today widget. I took a look around but nothing helped me. 回答1: Yes you can. I have just tested and it works. You just have to add your timer to the main run loop NSRunLoopCommonModes: RunLoop.main.add(yourTimerName, forMode: .commonModes) import NotificationCenter class TodayViewController: UIViewController, NCWidgetProviding { @IBOutlet weak var strTimer: UILabel! var timer = Timer() func updateInfo() { strTimer.text =

Custom button not displaying in Today Extension

[亡魂溺海] 提交于 2019-12-08 05:04:32
问题 I have some custom buttons in my host app that I'd like to use in the Today Extension. They work just fine in the app but do not display in the widget. The button on the left is my custom button class, the one on the right is a UIButton. If I change it to my custom class it too disappears. Any thoughts why this might be happening? ----------------------EDIT------------------------ Well, somehow I managed to get it to display but sometimes it's not drawing the whole button and sometimes it's