Linker error integrating ParseSwift SDK

Hello,

I am trying to integrate ‘ParseSwift’ SDK, but I am getting the following error.

Please help me, thanks in advance

Can you add information about your setup? From the info you provided it’s not easy to help.

  • Are you adding ParseSwift to a new/old app? If it’s an old app did it use the iOS SDK or something else?
  • Are you integrating using Swift Package Manager, Cocoapods, Carthage?
  • What version of Parse-Swift?
  • What version of Xcode?
  • Minimum version of app deployment?
  • Which OS are you building for?
  • Anything else about your environment?

Did you clean your build folder? If so, try to delete your DerivedData folder

Hi cbaker6,

  1. I am adding the Parse Swift to a new app.
  2. I am trying to integrate using Cocoapods
  3. Parse 1.2.0
  4. Xcode 12.3
  5. Min version iOS 12.0
  6. Building for iOS 14.3
  7. I am facing the same error, when I am trying to install ‘ParseLiveQuery’ pod too. Both the cases I am facing this issue.

I also deleted the derived data and checked, nothing works

You should remove ParseLiveQuery pod as that’s for the iOS Objective-C SDK and not related to Parse-Swift. Something seems weird about your setup. Any reason why you are using Cocoapods? You can try to remove the Parse-Swift pod and use Swift Package Manager, it’s easier to use and integrates better out-of-the-box,

https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app

If you want to still use pods, can you post the contents of your podfile.

@pierlux I believe you use Parse-Swift via Cocoapods correct? Did you ever see this issue? Any insight?

@cbaker6 , you got me wrong first I’ve tried using ParseLiveQuery, it throw me the same error, then I moved to Parse-Swift, which also shows the same error. I’ve also tried with Swift Package Manager still the same issue.

@cbaker6 , adding additional log, may be helpful in understanding better.

Undefined symbols for architecture arm64:
“nominal type descriptor for (extension in Foundation):__C.NSURLSessionWebSocketTask.Message”, referenced from:
symbolic _____y___________pG s6ResultO So25NSURLSessionWebSocketTaskC10FoundationE7MessageO s5ErrorP in ParseSwift.o
symbolic _____Sg So25NSURLSessionWebSocketTaskC10FoundationE7MessageO in ParseSwift.o
“enum case for (extension in Foundation):__C.NSURLSessionWebSocketTask.Message.data((extension in Foundation):__C.NSURLSessionWebSocketTask.Message.Type) → (Foundation.Data) → (extension in Foundation):__C.NSURLSessionWebSocketTask.Message”, referenced from:
closure #1 (Swift.Result<(extension in Foundation):__C.NSURLSessionWebSocketTask.Message, Swift.Error>) → () in ParseSwift.LiveQuerySocket.receive(__C.NSURLSessionWebSocketTask) → () in ParseSwift.o
“Swift.String.init(unsafeUninitializedCapacity: Swift.Int, initializingUTF8With: (Swift.UnsafeMutableBufferPointer<Swift.UInt8>) throws → Swift.Int) throws → Swift.String”, referenced from:
(extension in ParseSwift):Foundation.Data.hexEncodedString(options: (extension in ParseSwift):Foundation.Data.HexEncodingOptions) → Swift.String in ParseSwift.o
“(extension in Foundation):__C.NSURLSessionWebSocketTask.receive(completionHandler: (Swift.Result<(extension in Foundation):__C.NSURLSessionWebSocketTask.Message, Swift.Error>) → ()) → ()”, referenced from:
ParseSwift.LiveQuerySocket.receive(__C.NSURLSessionWebSocketTask) → () in ParseSwift.o
“type metadata accessor for (extension in Foundation):__C.NSURLSessionWebSocketTask.Message”, referenced from:
ParseSwift.LiveQuerySocket.connect(task: __C.NSURLSessionWebSocketTask, completion: (Swift.Error?) → ()) throws → () in ParseSwift.o
ParseSwift.LiveQuerySocket.send(
: Foundation.Data, task: __C.NSURLSessionWebSocketTask, completion: (Swift.Error?) → ()) → () in ParseSwift.o
closure #1 (Swift.Result<(extension in Foundation):__C.NSURLSessionWebSocketTask.Message, Swift.Error>) → () in ParseSwift.LiveQuerySocket.receive(__C.NSURLSessionWebSocketTask) → () in ParseSwift.o
outlined init with copy of Swift.Result<(extension in Foundation):__C.NSURLSessionWebSocketTask.Message, Swift.Error> in ParseSwift.o
outlined destroy of (extension in Foundation):__C.NSURLSessionWebSocketTask.Message? in ParseSwift.o
outlined init with copy of (extension in Foundation):__C.NSURLSessionWebSocketTask.Message? in ParseSwift.o
l_objectdestroy.111 in ParseSwift.o

“enum case for (extension in Foundation):__C.NSURLSessionWebSocketTask.Message.string((extension in Foundation):__C.NSURLSessionWebSocketTask.Message.Type) → (Swift.String) → (extension in Foundation):__C.NSURLSessionWebSocketTask.Message”, referenced from:
ParseSwift.LiveQuerySocket.connect(task: __C.NSURLSessionWebSocketTask, completion: (Swift.Error?) → ()) throws → () in ParseSwift.o
ParseSwift.LiveQuerySocket.send(
: Foundation.Data, task: __C.NSURLSessionWebSocketTask, completion: (Swift.Error?) → ()) → () in ParseSwift.o
closure #1 (Swift.Result<(extension in Foundation):__C.NSURLSessionWebSocketTask.Message, Swift.Error>) → () in ParseSwift.LiveQuerySocket.receive(__C.NSURLSessionWebSocketTask) → () in ParseSwift.o
"(extension in Foundation):__C.NSURLSessionWebSocketTask.send(: (extension in Foundation):__C.NSURLSessionWebSocketTask.Message, completionHandler: (Swift.Error?) → ()) → ()", referenced from:
ParseSwift.LiveQuerySocket.connect(task: __C.NSURLSessionWebSocketTask, completion: (Swift.Error?) → ()) throws → () in ParseSwift.o
ParseSwift.LiveQuerySocket.send(
: Foundation.Data, task: __C.NSURLSessionWebSocketTask, completion: (Swift.Error?) → ()) → () in ParseSwift.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This seems like you either don’t have your Xcode environment configured to a typical setup, your Swift language settings are too low, your project settings are not typical, or your build architecture is incorrect. My only other suggestions from what you’ve show are:

I have not run into this issue but it does look like you are trying to build against an older SDK.

What’s the platform value in your Podfile? Mine is:

platform :ios, '14.0'

@pierlux mine is

platform :ios, ‘12.0’

There you go: NSURLSessionWebSocketTask was introduced in iOS 13 and therefore it’s the minimum supported version to be able to support LiveQueries.

There you go: NSURLSessionWebSocketTask was introduced in iOS 13 and therefore it’s the minimum supported version.

It’s the minimum supported version for LiveQuery, but ParseSwift should still build on iOS 12 devices. You won’t be able to run LiveQuery through…

If your minimum required device can be iOS 13, you should follow the suggestion from @pierlux

@cbaker6 I’ve not dealt with backward compatibility in Swift yet but from my understanding, all of the iOS 13 code is properly marked with the @available decorator :man_shrugging: It should indeed build on iOS 12 (without the LiveQuery support).

I agree. I have 1 iOS 12+ app that uses ParseSwift and a 2 iOS 13+ apps (1 private and 1 public) that use it and I haven’t seen this build issue. The public app is below:

With @pierlux building fine in cocoapods and the 3 apps I have building fine with SPM, it leads me to believe something isn’t configured correctly with @naveen-mt Xcode environment/project. If you can build the ParseSwift repo like I mentioned above, then your Xcode is fine, your app project is setup incorrectly. If you can’t build the project, then your Xcode isn’t configured properly. You can also try to build my ParseCareKit repo which I know is setup correctly with ParseSwift 1.2.0.

1 Like

Adding here that the SDK extensively tested and built with current/older versions of Xcode along with older versions of Swift.

The CI builds are here which are currently building/testing against Xcode 12.4 and 11.7:

The build compatibility is further tested outside of the CI using Swift Package Index and builds on Swift 5.1+, iOS, macOS (ARM & Intel), watchOS, and Linux

1 Like

@cbaker6 thanks for your support, but couldn’t able to solve it. But the error I am facing is because of this.

func receive(_ task: URLSessionWebSocketTask) {
task.receive { (result) in

}

Undefined symbols for architecture x86_64:
“(extension in Foundation):__C.NSURLSessionWebSocketTask.receive(completionHandler: (Swift.Result<(extension in Foundation):__C.NSURLSessionWebSocketTask.Message, Swift.Error>) → ()) → ()”, referenced from:
mastreeMobileApp.LiveQuerySocket.receive(__C.NSURLSessionWebSocketTask) → () in File.o

Not sure why is this linking error, even after I set the minimum deployment target to iOS 13.0.

Did you fork Parse-Swift and build it in your Xcode along with running the playgrounds like I mentioned in my previous comment?

Did you try to build the sample project I posted?

Did you update your Xcode?

If so, can you tell us what happened?

ParsSwift is built for multiple versions of Xcode, some of which are not even aware of websockets and that error isn’t present. As I mentioned this seems like you configured something incorrectly or attempting to use the SDK in your project in an unknown way.

Also, what happened when you checked your tools in Xcode? Can you show a screen shot of tools in preferences (the second screen shot in the link)? My guess is this might be your problem and not the SDK.