tika tika - 6 days ago 5
iOS Question

iOS Swift Error - Objective C method ... provided by method

What does this error mean? This code compiled fine previous week. I noticed that when I change

func parser
to
func something
, there are no compilation errors, but the method, obviously, does not work at runtime and shows no output.

Any ideas?

enter image description here


**ERROR :** Objective-C method
'parser:didStartElement:namespaceURI:qualifiedName:attributes:'
provided by method
'parser(_:didStartElement:namespaceURI:qualifiedName:attributes:)'
conflicts with optional requirement method
'parser(_:didStartElement:namespaceURI:qualifiedName:attributes:)' in
protocol 'NSXMLParserDelegate'


Answer

If you look at the docs or the headers, you will see how to declare this method:

func parser(parser: NSXMLParser,
 didStartElement elementName: String,
    namespaceURI namespaceURI: String?,
   qualifiedName qualifiedName: String?,
      attributes attributeDict: [NSObject : AnyObject])

As you can see, those types are very different from the types you are using. You need to fix yours so they match these exactly.