Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

AddCityViewController bug #10

Open
W2N-git opened this issue May 31, 2015 · 2 comments
Open

AddCityViewController bug #10

W2N-git opened this issue May 31, 2015 · 2 comments

Comments

@W2N-git
Copy link

W2N-git commented May 31, 2015

fatal error: use of unimplemented initializer 'init(nibName:bundle:)' for class 'PocketForecast.AddCityViewController'

Just mistake in initializer name
required dynamic init(nibname : String?, bundle : NSBundle?)

@jasperblues
Copy link
Member

Oops, that's actually an Apple bug and I'd left the work-around un-commented in the last commit. In ApplicationAssembly.swift take a look tat these lines:

            definition.useInitializer("initWithNibName:bundle:") {
                (initializer) in

                initializer.injectParameterWith("AddCity")
                initializer.injectParameterWith(NSBundle.mainBundle())
            }

What happens is that this method will use vtable-style dispatch, even if a sub-class overrides it and marks it as dynamic. Therefore it can't be invoked dynamically with the objective-C runtime.

The workaround is to create another custom initializer, in this case simply init, hence the above code in the assembly should be commented out.

The other Swift issue that we encountered was #286, and this was fixed very quickly by Apple, but as I understand it, this one hasn't been submitted to them yet. (Let's face it the Radar bug tracker is kinda tedious, right?). But I'll do so today.

Meantime will comment that code again.

@jasperblues
Copy link
Member

Re-commented ApplicationAssembly.swift to apply workaround. Meanwhile submitted issue report, and here's the open radar: https://openradar.appspot.com/radar?id=6174436327686144

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants