0

I have subclassed NSFileWrapper to specialise it for my own file wrapper while retaining the file handling functionality that NSFileWrapper offers.

I have not overriden anything and not implemented any of the NSFileWrapper's initialisers in my subclass. Instead I have provided my own initialiser as appropriate for my file wrapper.

Inside the initialiser, I have used

super.init(URL: url, options: options, error: outError)

and attempted to do documentation = self.fileWrappers["Documentation"] as NSFileWrapper where documentation is a NSFileWrapper property in my subclass. But execution stops at this step saying

fatal error: use of unimplemented initializer 'init(URL:options:error:)' for class 'MyClass'

I don't understand what I am doing wrong. Is NSFileWrapper not meant to be subclassed? Why is it looking for the initialiser in the subclass in the first place?

EDIT: My initialiser is

init(playgroundURL url: NSURL!, options: NSFileWrapperReadingOptions, error outError: NSErrorPointer)

and I am passing nil to options and outError while calling it.

Roshan
  • 1,937
  • 1
  • 13
  • 25
  • Can you show the code where you declare options & outError? I don't think the issue is subclassing... – Grimxn Jul 03 '14 at 10:57
  • I have updated my question. In any case, XCode is complaining only in the next line when I do ```documentation = self.fileWrappers["Documentation"] as NSFileWrapper```. Doesn't this means the first phase of initialisation was successful? – Roshan Jul 03 '14 at 11:03
  • And based on the new rules for initialisers, shouldn't it be impossible for a designated initialiser to look for another designated initialiser in the same class(based on the whole 'funnel' concept and stuff) – Roshan Jul 03 '14 at 11:09

0 Answers0