Search code examples
iosxcodecocoapodsstatic-linkingpodspec

No visible @interface in Cocoapods


I am trying to modulize my app by splitting it in different sub projects. Inspired by this idea. So I splited my project to static libraries followed by that tutorial. I created a first library with some costume UIHelpers/Views. It has some dependencies which I defined in PodSpec file followed by AFNetworking example. (one of the dependencies is Choosy). I stored this library in bitBucket. Everything is working fine for that library(I can build it in Xcode). The problem start when I create a Model Library. I specify Git path of UIHelpers in the Model PodFile. Every time I get an error of No visible @interface for a category in Choosy (the error come from CocoaPod NOT in my project, the category is imported in the .mfile). I tried to play with link flags -ObjC,$(inhereted),-force_load included all of them.Objective-C categories in static library I cleaned the derived data. I read the CocoaPodTroubleShoutes.

Can somebody suggest what can be tried. There is a lot of question in stuck regarding that compile error but none of them helped me. I believe the problem somewhere in my PodSpec(cant be sure) pod lib linit I receive :
- ERROR | [iOS] Choosy/Choosy/Model/ChoosyAppInfo.m:32:19: error: no visible @interface for 'UIImage' declares the selector 'applyMaskImage:completion:'
My PodSec:

Pod::Spec.new do |s|
    #I tried this options:
    #s.xcconfig = { 'OTHER_LDFLAGS' => $(inherited) }
    #s.compiler_flags = '-ObjC'
    #'-all_load'
    #$(inherited)
    #'-DOS_OBJECT_USE_OBJC=0', '-Wno-format'
    #'-force_load'

   s.prefix_header_contents = '#import <UIKit/UIKit.h>', '#import <Foundation/Foundation.h>','#import <CoreGraphics/CoreGraphics.h>','#import "ARNStyles.h"'
   s.description  = <<-DESC
               A longer description of ARNUIHelpers in Markdown format.
               DESC
   s.homepage     = "http://EXAMPLE/ARNUIHelpers"
   s.platform     = :ios, "7.0"
   s.ios.deployment_target = "7.0"
   s.source_files  = 'UIHelpers/**/*.{h,m}' 
   s.requires_arc = true

   s.subspec 'Choosy' do |ss|
         ss.requires_arc = true
         ss.compiler_flags = '-force_load'
         ss.platform     = :ios, "7.0"
         ss.dependency 'Choosy'
       # ss.xcconfig = { "FRAMEWORK_SEARCH_PATHS" =>      "$(PODS_ROOT)/Headers/Public/Choosy"}
        # ss.ios.public_header_files = 'UIImage+ImageEffects.h'
   end

   s.subspec 'Dependencies' do |ss|
        #ss.ios.public_header_files = 'UIImage+ImageEffects.h'
         ss.requires_arc = true 
         ss.dependency 'FormatterKit'
   end
end

Solution

  • In the end it was my fault. The previous developer copied those files from Choosy pod and included it manually.We still use Choosy in other places. Unfortunately the error wasn't clear enough to deduce what was wrong.