0

In my Project, I use Cloudinary, while I using the following function in Xcode 7.3 it's working fine But in Xcode 8 I got error.

(Cannot convert value of type ([AnyHashable: Any]!,String!,Int!,AnyObject) -> () to expected argument type (CLUploaderCompletion).

How to I solve this error.

uploader.upload(forUpload, options: nil, withCompletion:onCloudinaryCompletion, andProgress:onCloudinaryProgress)


func onCloudinaryCompletion(_ successResult:[AnyHashable: Any]!, errorResult:String!, code:Int, idContext:AnyObject!) {
    print("successResult\(successResult)")
}

func onCloudinaryProgress(_ bytesWritten:Int, totalBytesWritten:Int, totalBytesExpectedToWrite:Int, idContext:AnyObject!) {        
    print("onCloudinaryProgress")

}

Screenshot of the error:

enter image description here

pedrouan
  • 12,762
  • 3
  • 58
  • 74

1 Answers1

0

In swift 3 some things have changed and one of those is that id from objective c is now Any in swift instead of AnyObject. Change your idContext to type Any.

Also you must also change the type of your dictionary and the string to an optional. So it becomes String? and [AnyHashable: Any]?.

Majster
  • 3,611
  • 5
  • 38
  • 60