richari1987
richari1987

Reputation: 360

Adding a .a file to a project via CocoaPods

I am currently working on a project that is using CocoaPods. This is my first experience using them and would love some help with an issue we are having.

We have multiple apps that use the same data models. Instead of duplicating code, we created a separate project that is added to each sub project as a pod file. In this project we also have a lot of our 3rd party libraries(Facebook SDK, GoogleAnalytics, etc) as they are used across our multiple applications. 2 libraries we use are Flurry 5.4.0 and Appsflyer. Unfortunately these guys are .a files as opposed to the other pod files which return .h files.

enter image description here

The base project we have will clean and compile no problemo. But when we try to add this project, through pods, to any of the sub project, it results in this compile error :

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AppsFlyerTracker", referenced from:
  objc-class-ref in libPods.a(SHAnalyticsUtility.o)
"_OBJC_CLASS_$_Flurry", referenced from:
  objc-class-ref in libPods.a(SHAnalyticsUtility.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have tried all different methods of updating the Podfile(https://github.com/CocoaPods/CocoaPods/issues/2018) and PodSpec(https://github.com/CocoaPods/Specs/issues/1483) file but nothing has worked so far. Any and all suggestions welcome :) PODSPEC

Pod::Spec.new do |s|


  s.name     = 'company-framework-ios'
  s.version  = '1.13.16'
  s.platform = :ios
  s.license  = 'MIT'
  s.summary  = 'Framework for all the iOS apps'

  s.source_files = 'CompanyFramework/CompanyFramework/*.{h,m}','CompanyFramework/CompanyFramework/**/*.{h,m}'

  s.frameworks = 'QuartzCore', 'CoreLocation'
  s.dependency 'Masonry'
  s.dependency 'Mixpanel'
  s.dependency 'GoogleAnalytics-iOS-SDK'
  s.dependency 'AFNetworking', '2.4.1'
  s.dependency 'NSDate+Calendar'
  s.dependency 'RXPromise'
  s.dependency 'SAMCategories'
  s.dependency 'FlurrySDK'
  s.dependency 'AppsFlyer-SDK'
  s.dependency 'Facebook-iOS-SDK', '3.18.2'

  s.ios.deployment_target = "7.1"

  s.requires_arc = true
  s.ios.vendored_library = 'Pods/FlurrySDK/Flurry/libFlurry_5.4.0.a'
  s.ios.vendored_library = 'Pods/AppsFlyer-SDK/libAppsFlyerLib.a'

end

Upvotes: 4

Views: 2336

Answers (1)

richari1987
richari1987

Reputation: 360

So the answer to this is that when you add the .a file to your custom pod, you also have to add the .a file to your project after installing your custom pod.

Upvotes: 2

Related Questions