0

This is my first question on stack overflow so please excuse if I miss any mannerisms.....

My Swift App uses the FXForms Cocoa Pod

It's an OBJ-C framework I'm using with my Swift app. Everything compiled fine before updating Xcode today. Now I am getting this error:

"Objective-C method 'fields' provided by method 'fields()' conflicts with optional requirement method 'fields()' in protocol 'FXForm'e

Any ideas? Happy to provide source code, etc.

Thanks for any help,

ztb

ZTB
  • 1
  • 1

3 Answers3

0

This is most likely caused by the update in Swift syntax. Look into the code if you use NSDictionary and replace with [NSObject: AnyObject]. Same for NSString replace with String. In most cases this will fix this issue.

You could try in Xcode to run Edit - Convert - To latest Swift Syntax. I did it on my project and no changes were made. But it is worth a try!

Have a look at this post which handles a similar error:

Objective-C method conflicts with optional requirement method Swift

Community
  • 1
  • 1
Ruud Kalis
  • 264
  • 3
  • 9
0

Replacing this:

func fields() -> NSArray {

    return [

with this:

func fields() -> [AnyObject}! {

        return [

did the trick.

ZTB
  • 1
  • 1
0

you can try this in swift 1.2:

func fields() -> [AnyObject]! {
    return fieldsArr as [AnyObject]
}
  • Thank you. This was exactly what I needed. Other solutions fooled the compiler but I lost some formatting from the FXForms Fields Array. This worked perfectly. – ZTB Apr 21 '15 at 01:07