weilsonwonder / WWCalendarTimeSelector

A android inspired iOS date/time picker
MIT License
317 stars 126 forks source link

UIStoryboard exception after swift 3.0 update #15

Closed Somojojojo closed 7 years ago

Somojojojo commented 7 years ago

Line 606 of WWCalendarTimeSelector.swift: let picker = UIStoryboard(name: "WWCalendarTimeSelector", bundle: bundle).instantiateInitialViewController() as! WWCalendarTimeSelector

2016-09-15 14:33:28.329 project name omitted[84835:4797498] Unknown class _TtC38WWCalendarTimeSelectorStoryboardBundle22WWCalendarTimeSelector in Interface Builder file. Could not cast value of type 'UIViewController' (0x10db73dd8) to 'WWCalendarTimeSelector.WWCalendarTimeSelector' (0x10e2b1028).

I've refactored my code to instantiate each time the selector is needed, and this error still comes up.

Can anybody else reproduce this? It happens when calling WWCalendarTimeSelector.instantiate()

Somojojojo commented 7 years ago

Hmm, I forked the project to try and figure the issue out. Even after instantiating the VC with an ID, it still throws an error... XCode 8 and Swift 3. Early adopter pains.

I'll comment again if I figure anything out, and submit a PR if I fix it.

EDIT: Inspecting the bundle variable, this is the output: NSBundle </Users/~~my user~~/Library/Developer/CoreSimulator/Devices/88E597EC-F3C8-43F3-A743-19C38C746FC4/data/Containers/Bundle/Application/8EA6A8B5-D6D9-4447-894A-AF20EF676134/projectname.app/Frameworks/WWCalendarTimeSelector.framework/WWCalendarTimeSelectorStoryboardBundle.bundle> (not yet loaded)

EDIT 2: Adding WWCalendarTimeSelector as the module in the storyboard file fixes the instantiate method, but now the lib is crashing when setting the delegate of clockView to self.

weilsonwonder commented 7 years ago

Hi, you can goto the storyboard and remove the modules from the uiviewcontrollers and one of the custom uiview. It should fix the errors. I'm having issues pushing onto cocoapods to update my library as well lol

apologies for the issues!

Somojojojo commented 7 years ago

I assume you meant to add the module to the main UIViewController and the WWClock UIView? That fixed the issue completely. Thanks for your help, @weilsonwonder :) Are you going to put that change into your repo, or do you want a PR?