title: Cannot convert value of type 'String?!' to expected argument type 'Notifications'
body: <p>I am trying to check the id of a record before I put it into the array, using <code>xcode</code> swift</p>
  
  <p>here is the code. But, i get the following error</p>
  
  <blockquote>
    <p><em>Notifications.swift:50:46: Cannot convert value of type 'String?!' to expected argument type 'Notifications'</em></p>
  </blockquote>
  
  <p>on this line  </p>
  
  <pre><code>*if (readRecordCoreData(result["MessageID"])==false)*
  </code></pre>
  
  <p>Please can some one help to explain this error</p>
  
  <pre><code>import CoreData
  
  struct Notifications{
  
  var NotifyID = [NSManagedObject]()
  
    let MessageDesc: String
    let Messageid: String
  
  
  init(MessageDesc: String, Messageid:String) {
  
      self.MessageDesc = MessageDesc
     self.Messageid = Messageid
     // self.MessageDate = MessageDate
  
  
  
  }
  
  static func MessagesWithJSON(results: NSArray) -&gt; [Notifications] {
      // Create an empty array of Albums to append to from this list
  
      var Notification = [Notifications]()
  
      // Store the results in our table data array
      if results.count&gt;0 {
  
          for result in results {
  
             //get fields from json
  
              let Messageid = result["MessageID"] as! String
              let MessageDesc = result["MessageDesc"] as? String
  
              let newMessages = Notifications(MessageDesc: MessageDesc!, Messageid:Messageid)
  
  
  
              //check with id's from core data
              if (readRecordCoreData(result["MessageID"])==false)
                 {
  
                  Notification.append(newMessages)
              }
  
  
  
          }
      }
      return Notification
  }
  
  //check id
  func readRecordCoreData(Jsonid: String) -&gt; Bool {
  
      var idStaus = false
  
      let appDelegate =
          UIApplication.sharedApplication().delegate as! AppDelegate
  
      let managedContext = appDelegate.managedObjectContext
  
      //2
      let fetchRequest = NSFetchRequest(entityName: "ItemLog")
  
  
      //3
      do {
  
          let resultsCD = try! managedContext.executeFetchRequest(fetchRequest)
  
  
  
          if (resultsCD.count &gt; 0) {
  
              for i in 0 ..&lt; resultsCD.count {
                  let match = resultsCD[i] as! NSManagedObject
                  let id = match.valueForKey("notificationID") as! String
  
                  if (Jsonid as String! == id)
                  {
                      idStaus = true
  
                  }
                  else{
  
                      idStaus = false
  
                  }
  
              }
          }
  
      } catch let error as NSError {
          print("Could not fetch \(error), \(error.userInfo)")
      }
  
      return idStaus
  
  }
  </code></pre>