0

I'm trying to test a FacebookAPI class I created, but when I add it to the test target, all my FacebookSDK classes inside FacebookAPI get "Use of unresolved identifier 'FBSession'" for example.

What should I do?

I'm using swift, thats why I have to add the FacebookAPI to the test target.

Rodrigo Ruiz
  • 4,248
  • 6
  • 43
  • 75
  • You need a bridging header. You can take a look SO posts like this one: http://stackoverflow.com/questions/24146677/swift-bridging-header-import-issue Better yet you should read the apple book 'Using Swift with Cocoa and Objective-C' – Anthony Kong Oct 03 '14 at 00:14
  • I already have a bridging header, thats how my FacebookAPI class can see the FacebookSDK if it is not in the test target. – Rodrigo Ruiz Oct 03 '14 at 04:43

1 Answers1

0

The issue for me was that you need to make sure that you have included the FBSDK Framework in the Link Binary With Libraries settings under Build Phases for your test target!

I used cocoapods and forgot to add the pods for my test target! Silly me.

Here's what my podfile looks like:

target 'AppName' do pod 'FBSDKCoreKit' pod 'FBSDKLoginKit' pod 'FBSDKShareKit' end target 'AppTests' do pod 'FBSDKCoreKit' pod 'FBSDKLoginKit' pod 'FBSDKShareKit' end

lovelejess
  • 86
  • 6