PivotalCoreKit
PivotalCoreKit copied to clipboard
PCKInterfaceControllerLoader doesn't initialize/binds IBOutlets and IBActions in XCode 8.3.2
PCKInterfaceControllerLoader doesn't initialize/binds IBOutlets and IBActions from watch storyboard in XCode 8.3.2
My target setup for testing watchOS > 2.0 is the same as in: https://content.pivotal.io/blog/apple-watch-2-0-with-tdd-setup
When callling:
- (id)interfaceControllerWithStoryboardName:(NSString *)storyboardName
identifier:(NSString *)objectID
bundle:(NSBundle *)bundle
from PCKInterfaceControllerLoader, it returns the correct WKInterfaceController, but all WKInterfaceObjects in this scene are not initialized.
This issue doesn't occur in XCode < 8.3.2
Oof, that's unfortunate that this started to break. First off, thanks for reporting this issue @thomas3687. I've been away from iOS development for a while, and it's cool to hear that people are using PCK (and even finding utility using it with WatchOS!).
Have you had any opportunity to dig into what's happening on Xcode 8.3.2? My best guess is that something deep inside our magic code that handles scene initialization for controllers broke with a new WatchOS toolchain in the latest Xcode 8.3.2, but I haven't spent the time digging in and finding out exactly what's wrong.
I've also run into trouble running some of the different framework specs locally on Xcode 8.3.2. Bootstrapping the bundle seems to fail on a missing symbol from WatchKit, even when WatchKit seems like it ought not to be needed/linked/loaded.
Maintainers (or anyone) can try to wrassle their way through rake travis
locally and see what I mean. This may or may not be the same
issue - still unclear to me.
Our Travis CI image is running Xcode 8.2 BTW.
Could this be due to the same root cause as #201 ? The tutorial you mention may no longer be valid now that WatchOS 1.0 has been deprecated.
are there any news on this issue?
The problem is that the system framework WatchKit.framework in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/WatchKit.framework
is also loaded and NSClassFromString
returns the real WatchKit class instead of the shadow class. The real implementation returns nil
from [[class alloc] init]
which is why all IBOutlets are nil too.
When running unit tests there are lots of warnings on initialization: Class WKInterfaceObject is implemented in both
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/WatchKit.framework/WatchKit and MyTestBundle.xctest/Frameworks/WatchKit.framework/WatchKit. One of the two will be used. Which one is undefined.`