dropbox / dropbox-sdk-obj-c

Official Objective-C SDK for the Dropbox API v2.
MIT License
183 stars 117 forks source link

Apple Mach-O Linker Error #146

Closed CrazyGoose closed 5 years ago

CrazyGoose commented 7 years ago

Pod is installed correctly. Followed all setup as outlined but I am getting the following errors:

"_OBJCCLASS$_DBClientsManager", referenced from:

clang: error: linker command failed with exit code 1 (use -v to see invocation)

If I comment out: [DBClientsManager setupWithAppKey:@"XXXXXXXXXX"]; everything complies without issue.

scobbe commented 7 years ago

@CrazyGoose: Do you have the .xcworkspace file open and not the .xcodeproj file?

CrazyGoose commented 7 years ago

I get errors with both.

Xcodeproj -> One error. clang: error: linker command failed with exit code 1 (use -v to see invocation)

xcworkspace -> two errors "OBJC_CLASS$_DBClientsManager", referenced from: clang: error: linker command failed with exit code 1 (use -v to see invocation)

scobbe commented 7 years ago

@CrazyGoose: To get the obvious stuff out of the way, would you mind confirming that you've restarted Xcode, and then run cmd+option+shift+k and done a clean build?

CrazyGoose commented 7 years ago

Yes,

I have cleaned derived data, restarted xcode, uninstalled pod, reinstalled pod.... many combination of each.

It is the minute I put in the code: [DBClientsManager setupWithAppKey:@"XXXXXXXXXX"]; The actual line of code does not show any errors. But it just wont compile.

scobbe commented 7 years ago

Would you mind trying the step here that involves adding $(inherited) to your project's Other Linker Flags in Build Settings, and ensure that the -ObjC flag is included in Other Linker Flags?

DBClientsManager uses categories, which can fail at link time sometimes if the -ObjC flag isn't added

CrazyGoose commented 7 years ago

I believe it is already there.

screen shot 2017-05-05 at 5 21 20 pm

scobbe commented 7 years ago

@CrazyGoose: Ok, thanks. Another thing – set BUILD ACTIVE ARCHITECTURE ONLY to NO for both debug and release in your project's build settings. Let me know if that helps at all.

scobbe commented 7 years ago

Also, if you run pod --version and it's less than 0.25.0, you may need to update (sudo gem update cocoapods)

CrazyGoose commented 7 years ago

Pod version 1.2.1 Changed Active Arch.. to NO for Debug. Release was already NO.

scobbe commented 7 years ago

@CrazyGoose: Sorry for the radio silence here. Wanted to follow up and see if this issue was still happening for you. If it is, would you mind sending in a redacted Xcode project to the following link:

https://www.dropbox.com/developers/contact

That way, we can debug it on our end and get to the bottom of this. Either way, let me know. Thank you!

Schwiiz commented 7 years ago

Hi scobbe, could you please help me with the same problem: ld: framework not found Pods-DBRoulette clang: error: linker command failed with exit code 1 (use -v to see invocation) I'm trying to run the sample code + all you suggestions above tried thanks!

scobbe commented 7 years ago

@Schwiiz: I assume you tried everything above?

Based on your error, it seems like you don't have the .xcworkspace file open (but instead the .xcodeproj file).

Would you mind confirming that you have the .xcworkspace file open while attempting to build?

Schwiiz commented 7 years ago

unfortunately, it's .xcworkspace. it looks like this:

screen shot 2017-06-05 at 18 58 10

scobbe commented 7 years ago

@Schwiiz: Oh this is the example project. Did you run pod install in the directory that contains the Podfile?

We don't distribute the framework code (ObjectiveDropboxOfficial) in the examples directly, but instead require you to fetch them. Let me know if this works.

scobbe commented 7 years ago

Oh wait, yeah we don't distribute the workspace files either, so you must have...

scobbe commented 7 years ago

@Schwiiz: Would you mind trying this:

In Project Navigator in the folder Pods look for Pods_DBRoulette.framework which is red in the above screenshot. It should also be present in Linked Frameworks and Libraries. Remove both references and see if that helps.

Schwiiz commented 7 years ago

@scobbe ok, let me try. thanks.

scobbe commented 7 years ago

@Schwiiz: Any word?

scobbe commented 7 years ago

Ping @Schwiiz and @CrazyGoose.

Any update? Where you able to get this to work?

igiso commented 7 years ago

I get a mac o linker Error _OBJCCLASS$_DBClientsManager", referenced from: objc-class-ref in ofxDropBox.o

When I run on Ipad, but on simulator everything runs ok? Any Ideas?

screen shot 2017-10-10 at 15 36 48 screen shot 2017-10-10 at 15 36 25 screen shot 2017-10-10 at 15 35 59 screen shot 2017-10-10 at 15 28 09
greg-db commented 7 years ago

@igiso Have you already tried the troubleshooting steps discussed earlier in this thread?

igiso commented 7 years ago

Yes I've tried, everything, I need to clarify, that my project works on Simulator, the linking problem is when testing on Device.

igiso commented 7 years ago

ps I didn't run those Pod files, I just dragged the ObjectiveDropboxOfficial.framework into the project

I tried to run them, but it made any difference

screen shot 2017-10-19 at 16 16 52
igiso commented 7 years ago

On the simulator I get this warning but it compiles:

screen shot 2017-10-19 at 16 22 03
igiso commented 7 years ago

I am putting a reference to this I think it is related:

https://github.com/drewmccormack/ensembles/issues/208

igiso commented 7 years ago

I've solved the problem, I had to rebuild the framework for the particular device and then relink it, but now it doesn't work on the simulator,

I created two projects with shared code but different linked frameworks..

greg-db commented 7 years ago

@igiso The SDK should work both on device and in the simulator. You'll need to pick one of the supported installation methods though, and follow all of the documented steps:

https://github.com/dropbox/dropbox-sdk-obj-c#sdk-distribution

It sounds like you only manually dragged in the ObjectiveDropboxOfficial.framework. To get this working, please try again using one of the officially supported installation methods.

monish152 commented 5 years ago

screen shot 2019-01-13 at 11 58 52 pm @scobbe getting same issue while adding manually. There is only xcodeproj file

greg-db commented 5 years ago

@monish152 I see you opened a new issue for your error (#238), so I'll follow up with you there to avoid spamming the other people on this old one.