drewmccormack / ensembles

A synchronization framework for Core Data.
MIT License
1.63k stars 132 forks source link

Linker error when using Ensembles/Dropbox in Swift project #222

Closed sarunw closed 8 years ago

sarunw commented 8 years ago

I try to use Ensembles with Dropbox on my Swift project, but got this error

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_DBRestClient", referenced from:
      objc-class-ref in CDEDropboxCloudFileSystem.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have created sample project to reproduce this error SwiftEnsemble.zip

But any Podfile looking like this would cause the error

# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!

target 'SwiftEnsemble' do
  pod 'Ensembles', '~> 1.0'
  pod 'Ensembles/Dropbox', '~> 1.0'
end
drewmccormack commented 8 years ago

The Ensembles podspec doesn’t use frameworks. It is still using static libraries, so you will probably have to use that.

Drew

On 06 Apr 2016, at 19:02, Sarun Wongpatcharapakorn notifications@github.com wrote:

I try to use Ensembles with Dropbox on my Swift project, but got this error

Undefined symbols for architecture x86_64: "_OBJCCLASS$_DBRestClient", referenced from: objc-class-ref in CDEDropboxCloudFileSystem.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) I have created sample project to reproduce this error SwiftEnsemble.zip https://github.com/drewmccormack/ensembles/files/206912/SwiftEnsemble.zip But any Podfile looking like this would cause the error

Uncomment this line to define a global platform for your project

platform :ios, '8.0'

Uncomment this line if you're using Swift

use_frameworks!

target 'SwiftEnsemble' do pod 'Ensembles', '~> 1.0' pod 'Ensembles/Dropbox', '~> 1.0' end — You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/drewmccormack/ensembles/issues/222

Christian1313 commented 8 years ago

On iOS Project i have a similar problem with the dropbox sdk. Perhaps this will help.

Based on the stack overflow thread: http://stackoverflow.com/questions/32969971/dropbox-ios-sdk-dropboxsdk-h-file-not-found i devices a procedure after every pod install of the dropbox sdk.

1.) Open Terminal 2.) go to project base folder (cd .... /Develop/YourProject ) 3.) Create Dropbox header folders: mkdir Pods/Headers/Private/Dropbox-iOS-SDK mkdir Pods/Headers/Public/Dropbox-iOS-SDK 4.) Link framework headers ln -s Pods/Dropbox-iOS-SDK/dropbox-ios-sdk-1.3.13/DropboxSDK.framework/Headers/* Pods/Headers/Public/Dropbox-iOS-SDK/ ln -s Pods/Dropbox-iOS-SDK/dropbox-ios-sdk-1.3.13/DropboxSDK.framework/Headers/* Pods/Headers/Private/Dropbox-iOS-SDK/

sarunw commented 8 years ago

So if I need to use use_frameworks! for other pods I have to manually integrate ensemble right?

drewmccormack commented 8 years ago

I don’t use Cocoapods much, so I’m not 100% sure. But it may be easier just to integrate it manually, yes.

Drew

On 07 Apr 2016, at 04:56, Sarun Wongpatcharapakorn notifications@github.com wrote:

So if I need to use use_frameworks! for other pods I have to manually integrate ensemble right?

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/drewmccormack/ensembles/issues/222#issuecomment-206672124

lrrrs commented 8 years ago

As far as I know, manually is the only way for now, because the Dropbox API is a static lib / binary and can't be integrated as a framework.

sarunw commented 8 years ago

For reference, Dropbox has new SDK for API v2 which support Swift and dynamic framework https://www.dropbox.com/developers/documentation/swift https://github.com/dropbox/SwiftyDropbox

drewmccormack commented 8 years ago

Yes, fully aware, but I don't have time to write a backend for it right now. I also don't know if I will bother using their SDK, given how bad the v1 SDK is. Might just write my own NSURLSession based backend for the REST API. Will have to take a look at some point.

sarunw commented 8 years ago

I failed to integrate Dropbox to the project (integrate ensemble work fine)

What I did are

  1. drag DropboxSDK Xcode project from Vendor > DropboxSDK > DropboxSDK > DropboxSDK.xcodeproj to my project
  2. In the General tab, click the + button in the Linked Frameworks and Libraries section and add libSDropboxSDK.a

but when I try #import "DropboxSDK.h" it error with file not found. Did I miss something here?

drewmccormack commented 8 years ago

You probably need to add an entry to the header search path. I think it is mentioned in the last chapter of the Ensembles book, about Dropbox.

Kind regards, Drew

On 07 Apr 2016, at 19:29, Sarun Wongpatcharapakorn notifications@github.com wrote:

I failed to integrate Dropbox to the project (integrate ensemble work fine)

What I did are

  1. drag DropboxSDK Xcode project from Vendor > DropboxSDK > DropboxSDK > DropboxSDK.xcodeproj to my project
  2. In the General tab, click the + button in the Linked Frameworks and Libraries section and add libSDropboxSDK.a

but when I try #import "DropboxSDK.h" it error with file not found. Did I miss something here?

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

sarunw commented 8 years ago

Thank you very much.