fatal error: call of removed method

Hi,


Does anyone have any clue about this error message?

fatal error: call of removed method


I am getting this crash from Xcode after trying to use a Class function from a custom framework made in Swift.


Setup is as follow


public protocol Something { 
  var prop1: String   { get } 
  var prop2: [String] { get } 
  var prop3: [String] { get } 
  ... 
} 

public class Things { 
  public class func stuffWithName(name: String) throws -> Something { 
       return try Stuff(name: name) 
  } 
} 

struct Stuff: Something { 
  let prop1: String 
  let prop2: [String] 
  let prop3: [String] 

  init(name: String) throws { 
     ...do stuff... 
  } 
}


Things.stuffWithName("Sockets")


This works perfectly in Unit Testing but crash when the framework is used within an App.

The weirdest is that I have other objects using the exact same architecture and they don't crash.


Any clues where I could dig further?


Cheers

Answered by DamienP in 17800022

Nevermind. After cleaning the project, Xcode started to complain the Framework "image" was missing and I adding the framework in "embedded" instead of "linked" solved the problem. I don't even understand how it was working before but anyway, problem solved.

I'm pretty sure init can't throw.

You can. This from NSString doc.


convenience init(contentsOfFile path: String, encoding enc: UInt) throws
Accepted Answer

Nevermind. After cleaning the project, Xcode started to complain the Framework "image" was missing and I adding the framework in "embedded" instead of "linked" solved the problem. I don't even understand how it was working before but anyway, problem solved.

fatal error: call of removed method
 
 
Q