-1

after updating my Xcode i'm getting error in backendless's find Syntax e.g.

   dataStore.find(
        { (result: BackendlessCollection!) -> Void in
            let contacts = result.getCurrentPage()
            for obj in contacts {
                print("\(obj)")
            }
        },
        error: { (fault: Fault!) -> Void in
            print("Server reported an error: \(fault)")
    })

and the error is : Cannot convert value of type '(BackendlessCollection!) -> Void' to expected argument type '((BackendlessCollection?) -> Void)!'

how can i fix it ???

remy boys
  • 2,928
  • 5
  • 36
  • 65
  • The compiler suggests to replace `(result: BackendlessCollection!) -> Void` with `((result: BackendlessCollection?) -> Void)!` – vadian Sep 19 '16 at 06:38
  • oh okay tell me something that i dont know about , how can i do it ? – remy boys Sep 19 '16 at 06:39
  • 1
    What is unclear to replace code with other code? – vadian Sep 19 '16 at 06:43
  • `(result: BackendlessCollection?)` like this ? @vadian – remy boys Sep 19 '16 at 06:46
  • Replace the entire expression on the left side with the entire expression on the right side. – vadian Sep 19 '16 at 06:50
  • can you explain how do we have 2 sides here ? – remy boys Sep 19 '16 at 07:05
  • In your code replace the occurrence of the first type in single quotes in the error message (left side) with the second type in single quotes in the error message (right side). In my first comment I described exactly and literally what to replace. If you still don't understand that, I give up, sorry. – vadian Sep 19 '16 at 07:12

1 Answers1

1

Replace the code with

dataStore?.find(
        { (result: BackendlessCollection?) -> Void in
            let contacts = result?.getCurrentPage()
            for obj in contacts! {
                print("\(obj)")

            }
        },
        error: { (fault: Fault?) -> Void in
            print("Server reported an error: \(fault)")
    })
Ragul
  • 3,176
  • 3
  • 16
  • 32