Driftt / drift-sdk-ios

Drift for iOS, for integrating Drift into your iOS application.
http://www.drift.com
MIT License
12 stars 17 forks source link

Undefined symbols for architecture x86_64 #93

Closed vuhoangha closed 4 years ago

vuhoangha commented 4 years ago

I tried installing drift-sdk-ios module with pod version 1.8.4 and xcode 11.3 but it didn't worked. Xcode displayed errors:

Undefined symbols for architecture x86_64:
  "Foundation.URLRequest.httpMethod.getter : Swift.String?", referenced from:
      Starscream.WebSocket.(createHTTPRequest in _E91840E7069A0D2D302D042308E9D928)() -> () in libStarscream.a(WebSocket.o)
      closure #1 (Foundation.URLRequest) -> Swift.String in Alamofire.DataResponse.debugDescription.getter : Swift.String in libAlamofire.a(Response.o)
      closure #1 (Foundation.URLRequest) -> Swift.String in Alamofire.DownloadResponse.debugDescription.getter : Swift.String in libAlamofire.a(Response.o)
      Alamofire.Request.description.getter : Swift.String in libAlamofire.a(Request.o)
      Alamofire.Request.cURLRepresentation() -> Swift.String in libAlamofire.a(Request.o)
      Alamofire.URLEncoding.encode(_: Alamofire.URLRequestConvertible, with: [Swift.String : Any]?) throws -> Foundation.URLRequest in libAlamofire.a(ParameterEncoding.o)
  "Foundation.URLRequest.httpMethod.setter : Swift.String?", referenced from:
      (extension in Alamofire):Foundation.URLRequest.init(url: Alamofire.URLConvertible, method: Alamofire.HTTPMethod, headers: [Swift.String : Swift.String]?) throws -> Foundation.URLRequest in libAlamofire.a(Alamofire.o)
      Drift.DriftRouter.asURLRequest() throws -> Foundation.URLRequest in libDrift.a(DriftAPIURLRouter.o)
      Drift.DriftCustomerRouter.asURLRequest() throws -> Foundation.URLRequest in libDrift.a(DriftAPIURLRouter.o)
      Drift.DriftConversationRouter.asURLRequest() throws -> Foundation.URLRequest in libDrift.a(DriftAPIURLRouter.o)
      Drift.DriftConversation2Router.asURLRequest() throws -> Foundation.URLRequest in libDrift.a(DriftAPIURLRouter.o)
      Drift.DriftMessagingRouter.asURLRequest() throws -> Foundation.URLRequest in libDrift.a(DriftAPIURLRouter.o)
  "Foundation.URLRequest.cachePolicy.getter : __C.NSURLRequestCachePolicy", referenced from:
      closure #1 () -> () in AlamofireImage.ImageDownloader.download(_: Alamofire.URLRequestConvertible, receiptID: Swift.String, filter: AlamofireImage.ImageFilter?, progress: (__C.NSProgress) -> ()?, progressQueue: __C.OS_dispatch_queue, completion: (Alamofire.DataResponse<__C.UIImage>) -> ()?) -> AlamofireImage.RequestReceipt? in libAlamofireImage.a(ImageDownloader.o)
  "Foundation.URLRequest.timeoutInterval.getter : Swift.Double", referenced from:
      Starscream.WebSocket.(initStreamsWithData in _E91840E7069A0D2D302D042308E9D928)(Foundation.Data, Swift.Int) -> () in libStarscream.a(WebSocket.o)
  "Foundation.URLRequest.timeoutInterval.setter : Swift.Double", referenced from:
      Starscream.WebSocket.__allocating_init(url: Foundation.URL, protocols: [Swift.String]?) -> Starscream.WebSocket in libStarscream.a(WebSocket.o)

Please help me. Thank you!

eoinoconnell commented 4 years ago

Hello, how strange. Does this happen when using the example app in the repo? What version of the SDK are you using? I assume 1.8.4 is your cocoa pods version

vuhoangha commented 4 years ago

No, I'm using my project. I used version 2.2.11 of drift-sdk-ios. My cocoa pods version is 1.8.4

eoinoconnell commented 4 years ago

Can you please try the example project to see if it happens there also?

It sounds like it might be a conflict with dependencies

vuhoangha commented 4 years ago

I try running the example but I see errors

Screen Shot 2019-12-16 at 4 21 25 PM
eoinoconnell commented 4 years ago

Just to confirm you opened the workspace and not the project file ye?

vuhoangha commented 4 years ago

I am not an ios programmer, I am a react native developer. So there are many things I don't understand about ios. If you need me to provide any additional information so you can spot the error, I'd be happy to. Thank you!

vuhoangha commented 4 years ago

Just to confirm you opened the workspace and not the project file ye?

I went to SDKExample folder and run "Pod install". Then I opened SDKExample.xcworkspace and run it. Is it right?

eoinoconnell commented 4 years ago

Yeah that should be it. Have you made any changes to your system or anything. It seems to be not able to find String.swift which seems rather strange. Do you have a custom installation of swift on your machine?

vuhoangha commented 4 years ago

I add lines on file Podfile

   pod 'SVProgressHUD', :modular_headers => true
   pod 'Drift', '~> 2.2.11'

Then I deleted Pods folder, ran "pod install" and built it. I tried running on 3 different computer but I got the same error

eoinoconnell commented 4 years ago

is there any other dependencies in your pod file? how come you are using modular_headers for the progress hud?

vuhoangha commented 4 years ago

I added modular_headers because I got an error when I ran pod install

[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `Drift` depends upon `SVProgressHUD`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
eoinoconnell commented 4 years ago

Ah ok, do you have use_frameworks! at the top of your podfile? If not could you add it, remove the modular_headers and try again?

Phu-Hoang commented 4 years ago

Currently most libraries discourage using use_frameworks!. Do you have any other solutions?

eoinoconnell commented 4 years ago

Hi, currently we only support use_frameworks I'm afraid

eoinoconnell commented 4 years ago

Hi, as of 2.4.0 we now support static building the library so you should no longer need use_frameworks!