Search code examples
xcodeswiftresearchkit

Undefined symbols for architecture x86_64 when using ORKESerializer


The past couple weeks I have been developing a ResearchKit app. I have run into some errors when I try to turn my survey data into JSON. I added some serialization code and when I try to run I get these two errors. Please find the below screenshot for more information.

enter image description here

I have tried changing the architectures in Build Settings but to no avail. How do I fix this? ORKESerializer code:

let decodedData = try ORKESerializer.JSONDataForObject(data)

print("decoded data: \(decodedData)")

if let jsonString = NSString(data: decodedData, encoding: NSUTF8StringEncoding) {

      print(jsonString)

}

My bridging header code:

#import "ORKESerialization.h"

My architectures/valid architectures:

$(ARCHS_STANDARD)
x86_64

Solution

  • It looks like by default, the ORKESerializer class isn't part of the ResearchKit framework. (See this comment.) It may be included in the tests, however.

    To use it in your app, the code needs to be compiled/linked in, so you need to add ORKESerialization.m to one of your targets.