ld: framework not found Stripe for architecture x86_64

20,029

Solution 1

I had to do two things to get this working:

  1. Add "$(SRCROOT)/../.." (since Project B lives two folders deep inside Project A) to "Framework Search Paths" under Build Settings -> "Search Paths" for the Project B target.

  2. Add the Stripe SDK to Project B's frameworks as well. This second step in particular surprised me because Project B does not rely directly upon Stripe.

Solution 2

I was seeing this same issue with another framework while running my test target. I had to add the framework to my test target (not only my normal target) under Build Phases > Link Binary With Libraries section.

Carthage has more info about the issue I saw: https://github.com/carthage/carthage#adding-frameworks-to-unit-tests-or-a-framework

Solution 3

Did you run into this issue when you ran your test cases?

So this is how my podfile looks like:

def shared_pods
    pod ‘GoogleMaps', '~> 1.13.0'
    pod ‘SwiftyJSON', '~> 2.3.2'
    pod ‘Alamofire', '~> 3.2.1'
    pod ‘MGSwipeTableCell’
end

target 'projectName' do
   shared_pods
end

So then I added this to podfile:

target ‘ProjectTests’ do
    pod ‘Nimble’, ‘~> 4.0.0’
    pod ’Quick’
end

What I also needed to do was:

target ‘ProjectTests’ do
    shared_pods // I needed to add this line as well. Since this line included the needed 'MGSwipeTableCell' framework 
    pod ‘Nimble’, ‘~> 4.0.0’
    pod ’Quick’
end

So a possible reason would be that in your podfile you didn't add them correctly, just be sure that the framework is added into the necessary targets.

Solution 4

Noticed this problem while switching some dependencies from pods to carthage. Similar to Honey's answer, I was able to get around this error modifying the podfile.

Turns out all I had to add was the test target. Then run 'pod install', and it will link your test target to your the frameworks generated by your pods.

target 'Project' do
  use_frameworks!

  //pods here normally

  target 'ProjectTests' do
   //nothing in here
  end
end
Share:
20,029
Lane Rettig
Author by

Lane Rettig

Hacker, philosopher, polyglot, runner, adventurer, entrepreneur, MBA, novice economist, breaker of molds large and small.

Updated on July 09, 2022

Comments

  • Lane Rettig
    Lane Rettig almost 2 years

    I have an iOS component which relies on the Stripe iOS SDK, Project A. I included the Stripe SDK in Project A in Xcode and it compiles fine.

    However, I'm building another project in Xcode which relies on this component, Project B. I added Project A to Project B's libraries. Project A relies on project B but does not rely directly on the Stripe SDK.

    Now, whenever I try to compile Project B, I get this error:

    ld: framework not found Stripe for architecture x86_64

    This line (inside Project A) seems to trigger the error:

    #import <Stripe/Stripe.h>

    Xcode has no trouble finding Stripe.h. I tried adding the Stripe SDK directly to Project B as well. I've double and triple-checked the Build Phases -> Link Binary With Libraries section for all targets (Stripe.framework is listed).

    I added the Stripe framework manually, so then I also tried adding it with Cocoapods instead, but that also didn't work.

    Please help!

    Here's the project structure for Project B ("example"), with Project A ("RCTFBLogin") below it.

    enter image description here

    Here's the full error:

    enter image description here

    I'm using Xcode 7.2 and the most recent version of the Stripe SDK (6.0.0). The same Stripe framework code works fine in another project.

    Thanks.

    Update: I added "$(SRCROOT)/../.." (since Project B lives two folders deep inside Project A) to "Framework Search Paths" under Build Settings -> "Search Paths" for the Project B target and it began compiling successfully. However, I now get this error when running:

    ld: warning: Auto-Linking supplied '/Users/rettig/wip/react-native-facebook-login.2/Stripe.framework/Stripe', framework linker option at /Users/rettig/wip/react-native-facebook-login.2/Stripe.framework/Stripe is not a dylib
    Undefined symbols for architecture x86_64:
      "_OBJC_CLASS_$_Stripe", referenced from:
          objc-class-ref in libRCTFBLogin.a(RCTFBLogin.o)
    ld: symbol(s) not found for architecture x86_64
    
  • kuzdu
    kuzdu almost 7 years
    man one hour I'm searching for a solution. I deleted all my derived data, clean my project more than once and tried to link my testtarget manually. work for me - thanks!