I'm writing an app which also has a Today extension (or widget). Apple's recommended method of sharing code between extensions and containing apps is to put the shared code inside of an embedded framework which both the app and extension can use. So as I understand it, I'm supposed to write shared code and make the shared code target the framework, and then have the app and extension both declare the framework as a dependency. However, in practice, I'm finding that while the app recognizes the framework just fine, the Today extension does not.
To be more specific: I'm putting a simple table view in a controller inside of both my Today extension (which I will call 'Widget') and as a tab in my app (which I will call 'App'), and then a framework (I'll call 'Framework') with shared code. Widget comes with a TodayViewController which contains the table view. This table view has a custom cell I'm calling CalendarCell. So the relevant shared classes/files are:
- TodayViewController.h/m
- CalendarCell.xib
- CalendarCell.h/m
And then, of course, I have my Widget storyboard and App storyboard, which are not shared.
So, in my App target build phase, I have Framework as a target dependency and also Widget as a target dependency (it came that way when I created the target, and removing it doesn't seem to have helped anything). Similarly, in the Widget target build phase, I have Framework as a target dependency. Framework lists TodayViewController.m and CalendarCell.m as compile sources and CalendarCell.xib as a bundle resource.
So here's what goes wrong: if Widget doesn't also list CalendarCell.m, TodayViewController.m, and CalendarCell.xib as compile sources and bundle resources, then the widget just doesn't work. Specifically, if TodayViewController.m isn't listed, then the app fails to even run in the simulator (I get the same error this person got). If TodayViewController.m is listed but any of the other source files / resources aren't, then I get an extension with no body (same as this other person got). Note that App does recognize the framework just fine and doesn't have to list these files as compile sources or bundle resources - it's just the Widget that fails.
If anyone has thoughts on this, I'd appreciate it. An Xcode 6 / iOS 8 bug? Or something I'm doing wrong?