0

I have a project written in Swift with CocoaPods installed. The project have a Today Extension and I added some Pods to this Target. So far so good.

Running on Simulator it's okay! But running on device I got this error:

dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire

Searching on web I found a post from Natasha The Robot talking about the right way to create your Pod file and my Pod seems like this:

# Podfile

platform :ios, '8.0'

use_frameworks!

# My other pods

def my_pods
    pod 'Alamofire'
end

target 'MyAppTarget' do
    my_pods
end

target 'MyTodayExtensionTarget' do
    my_pods
end

I've tried to use link_with but the same error appears

The only solution that I found was deintegrate Cocoapods and add manually the Frameworks.

Does anyone have other solution?

Thanks

Nathan Hegedus
  • 344
  • 6
  • 15

1 Answers1

1

Have you tried to repeat your pods in your two targets? Maybe it's not a very clean solution but I've a project with the same situation as yours an it's working with a Podfile like this one:

# Podfile example
source 'https://github.com/CocoaPods/Specs.git'

inhibit_all_warnings!

target 'mainapp', :exclusive => true do
    platform :ios, '8.0'

    #Crashlytics
    pod 'Fabric'
    pod 'Crashlytics'

    #Google analytics
    pod 'Google/Analytics', '~> 1.0.0'
end

target 'widget', :exclusive => true do 

    platform :ios, '8.0'

    #Crashlytics
    pod 'Fabric'
    pod 'Crashlytics'

    #Google analytics
    pod 'Google/Analytics', '~> 1.0.0'

    #Logging
    pod 'CocoaLumberjack', '~> 2.0'
end
andreacipriani
  • 2,519
  • 26
  • 23