Today Extension using NSExtensionPrincipalClass in swift requires you to specify an @objc class name
| Originator: | liam.nichols.LN | ||
| Number: | rdar://17594568 | Date Originated: | 08-Jul-2014 08:37 PM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 8.0 (beta 3) |
| Classification: | Serious Bug | Reproducible: | Always |
Summary: Today extensions in Swift do not work if you specify the NSExtensionPrincipalClass key unless you make your class Objective C compatible with the @objc flag. Steps to Reproduce: Create a Single View iOS Xcode project using Xcode 6.0 (6A254o) Make sure the language is set to Swift Add a Today Extension target also with the swift language Delete the Maininterface.storyboard file generated by the template in the extension target In the Extensions Info.plist, remove the NSExtensionMainStoryboard key In the Extensions Info.plist, add the NSExtensionPrincipalClass key and set its value to the view controllers class name (TodayViewController) Build and Run the Widget Expected Results: The widget should run and no exceptions should be thrown Actual Results: An exception is thrown because the device cannot find the view controller specified by the NSExtensionPrincipalClass key. Version: iPhone 5s Simulator from Xcode 6.0 (6A254o) Notes: You can get around this by specifying @objc(TodayViewController) above the Class declaration in the swift file however the application shouldn’t have to specify that its an Objective C class itself. I am assuming this i a bug because there is no mention of it in the App Extension Programming Guide I also started a thread before i fixed the issue on the devforms: https://devforums.apple.com/thread/235168?tstart=0 Configuration: iPhone Simulator from Xcode 6.0 (6A254o) Attachments:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Liam Nichols
Attached a test project with steps to reproduce the bug in the comments. see the top of TodayViewController.swift for more information. Or feel free to give me a shout.
Thanks, Liam 'BugReport-17594568.zip' was successfully uploaded. (https://www.dropbox.com/s/ih7x7berhiuf8rf/BugReport-17594568.zip)
Apple Developer Relations
Important: Please make sure all testing is done on the most recent beta; iOS 8 Seed 3 (Build 12A4318c).
Engineering has requested a test case/sample app in order to further investigate this issue.
Test Case/Sample App Requirements:
https://developer.apple.com/bug-reporting/ios/test-case/
Also, please review your original steps to reproduce to ensure they still clearly define the problem. If you did not provide steps to reproduce, please do so, along with any other relevant logs. For instructions on providing logs, please go to: https://developer.apple.com/bug-reporting/using-bug-reporter/additional-information/.