title: type of expression is ambiguous without more context Swift when using coredata
body: <p>I am getting the following error</p>
  <blockquote>
  <p>type of expression is ambiguous without more context</p>
  </blockquote>
  <p>this is occurring in my function where i update my core data.</p>
  <p>the update function looks like this:</p>
  <p><strong>AppDelegate.swift</strong></p>
  <pre><code>func updateFriend(studentID: Int, firstName: String, lastName: String,gender: String, courseStudy: String, age: Int, address: String) {
      
        
          guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {return}
          let managedContext = appDelegate.persistentContainer.viewContext
          
          let fetchRequest: NSFetchRequest&lt;Friends&gt; = Friends.fetchRequest()
          fetchRequest.predicate = NSPredicate.init(format: &quot;studentID==\(studentID)&quot;)
          do {
              let test = try getContext().fetch(fetchRequest)
              
              let transc = test[0] as NSManagedObject
              transc.setValue(studentID, forKey: &quot;studentID&quot;)
              transc.setValue(firstName, forKey: &quot;firstName&quot;)
              transc.setValue(lastName, forKey: &quot;lastName&quot;)
              transc.setValue(gender, forKey: &quot;gender&quot;)
              transc.setValue(courseStudy, forKey: &quot;courseStudy&quot;)
              transc.setValue(age, forKey: &quot;age&quot;)
              transc.setValue(address, forKey: &quot;address&quot;)
              
              do {
                  try managedContext.save()
              }
              catch{
                  print(error)
              }
              
          }
          catch{
              print(error)
          }
      }
  </code></pre>
  <p>and this is how i am using it:</p>
  <p><strong>editFriendClass.swift</strong></p>
  <pre><code>import UIKit
  
  class editFriendClass: UIViewController {
  
      @IBOutlet weak var studentID: UITextField!
      var textstr :String?
      var friends: [Friends] = []
      var a:Int? = 0
     
      @IBOutlet weak var study: UITextField!
      @IBOutlet weak var address: UITextField!
      
      @IBOutlet weak var gender: UITextField!
      @IBOutlet weak var lastName: UITextField!
      @IBOutlet weak var firstName: UITextField!
      @IBOutlet weak var age: UITextField!
      
      let appDelegate = UIApplication.shared.delegate as! AppDelegate
      func textViewShouldBeginEditing(textView: UITextView) -&gt; Bool {
          return false
      }
      override func viewDidLoad() {
          super.viewDidLoad()
          studentID.isUserInteractionEnabled = false
          studentID.text = textstr;
           a = Int(studentID.text!)
        
          friends = appDelegate.getFriendInfo_single(id: a!)
          
          firstName.text = friends[0].firstName
          lastName.text = friends[0].lastName
          age.text = &quot;\(friends[0].age)&quot;
          gender.text = friends[0].gender
          address.text = friends[0].address
          study.text = friends[0].courseStudy
         
      }
      
      @IBAction func update(_ sender: Any) {
          appDelegate.updateFriend(studentID: a, firstName: firstName.text, lastName: lastName.text, gender: gender.text, courseStudy: study.text, age: age.text, address: address.text)
  //        appDelegate.updateFriend(studentID: 111211, firstName: &quot;wil&quot;, lastName: &quot;wil&quot;, gender: &quot;wil&quot;, courseStudy: &quot;wil&quot;, age: 32, address: &quot;wil&quot;)
      }
      
      
  }
  </code></pre>
  <p>the error comes at</p>
  <pre><code>appDelegate.updateFriend(studentID: a, firstName: firstName.text, lastName: lastName.text, gender: gender.text, courseStudy: study.text, age: age.text, address: address.text)
  </code></pre>
  <p>but when i replace it will the line commented out below it
  it works successfully.</p>