Updated Xcode to v9.3.
Project was compiling fine under Xcode 9.2, I expected the same under the new version.
I got this error:
Undefined symbols for architecture arm64:
"protocol witness table for __ObjC.JSONSerialization.ReadingOptions : Swift.SetAlgebra in Foundation", referenced from:
LekaApp_iPad_DEV.CurriculumManager.(loadCurriculums in _A5F149B02226DB2DB0795B496BA6C22D)() -> () in CurriculumManager.o
function signature specialization <Arg[1] = Dead, Arg[2] = Dead, Arg[3] = Dead> of LekaApp_iPad_DEV.CurriculumViewInterfaceViewController.getLessonKeyValue(curriculum: Swift.Int, lessonId: Swift.Int, key: Swift.String) -> Swift.String in CurriculumInterfaceViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
List the software versions you're using:
Xcode Default - 4.1Please also mention which package manager you used and its version. Delete the
other package managers in this list:
After more investigation, I solved the issue.
We were using: let json = try? JSON(data: data!) which was working well under Xcode 9.2.
Changing it to let json = JSON(data!) fixed the issue.
@ladislas you save my day. Thanks man. But do you think its safe ?
@munsifhayat Good question! I guess no, it's not the safest way to do it. You could guard json afterwards.
In our case, we first guard against data, so we only perform the JSON task if data exists.
Note that I haven't tried the old way with Xcode 9.4.1, maybe it's working again.
The same problem at XCode 9.4.1
Fixed by changing
if let data = data
{
let json = try! JSON(data: data)
}
To
if let data = data
{
let json = JSON(data)
}
Most helpful comment
After more investigation, I solved the issue.
We were using:
let json = try? JSON(data: data!)which was working well under Xcode 9.2.Changing it to
let json = JSON(data!)fixed the issue.