0

In my project, I have an Action extension that uses a class in my main project. The class then uses a class installed from a pod, specifically . I had a problem automatically linking the extension to the pods, but manage to do that manually by selecting the extension target, then the General tab and adding each of the pods to the Linked Frameworks and Libraries.

Now I'm seeing this:

ld: warning: directory not found for option '-L/Users/apfritts/Box/Pencils/build/Debug-iphoneos'
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_User", referenced from:
      objc-class-ref in ActionViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It looks like my build targets are 64-bit (arm64, arm7, arm7s) so I'm not sure why it's saying undefined symbols for x86_64.

MGY
  • 7,245
  • 5
  • 41
  • 74
AP Fritts
  • 435
  • 2
  • 11

1 Answers1

0

I've mucked around with manually setting dependencies for extensions and it's easy to forget what you've done, making it difficult to reproduce your work if you need to change the pods you rely on or make some other structural change.

Instead, in your Podfile you can set the targets you explicitly want the pods to link with:

link_with 'App Name', 'Extension Name'

Every pod you list afterward will be applied to both targets.

Or if your targets have different dependencies, you can add pods for just one of the targets (and still leave the common pods without specifying target):

target :'Extension Name' do
  pod 'somepod'
end

The only problem I had is that cocoapods creates a separate xcscheme for each target but sets both targets to use only one of the schemes. I had to manually switch the scheme used by the extension. I'll update with a screenshot when I get home.

Duc
  • 487
  • 1
  • 7
  • 15