0

The error said that "Use of self in delegating initializer before self.init is called". Does anyone know how to fix this issue????

     convenience init(tweet: Dictionary<String, String>) {
    let _contents: String = ""
    //var _date: String = ""
    //var _reply_cnt: String = "0"
    let _like_cnt: String = "0"
    //var _bad_cnt: String = "0"
    let _imageUrl: String?

     //code below is the reason why got error
    self.init(contents:_contents, /*date:_date, reply_cnt:_reply_cnt, */like_cnt:_like_cnt,/* bad_cnt:_bad_cnt, */imageUrl:imageUrl)
stack0101
  • 3
  • 4
  • And what is the debug error? As in - what does Xcode spit out in the debug – iSkore Jan 21 '16 at 03:53
  • Please refer this post. http://stackoverflow.com/questions/24373142/adding-convenience-initializers-in-swift-subclass – Varun Jan 21 '16 at 18:56

1 Answers1

1

Going on a limb here, but your variable in the function is called _imageUrl, and the parameter passed into the self.init call is imageUrl, so perhaps that variable is invoking self.imageUrl prior to calling self.init as the error is stating.

Kevin DiTraglia
  • 25,746
  • 19
  • 92
  • 138