Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Development CocoaPod for both iOS and OSX

I've got a CocoaPod published for iOS and want to make it available on OS X as well. I've fixed up my PodSpec so that it's ready for both iOS and Mac OS X:

Pod::Spec.new do |s|
  s.name             = "EveryoneAPI"
  s.version          = "0.9.5"
  s.summary          = "An objective-c wrapper for EveryoneAPI.com's API"
  s.description      = <<-DESC
                       To retrieve all information for EveryoneAPI use the following:
                            EveryoneAPI *everyoneAPI = [[EveryoneAPI alloc] initWithAccountSID:@"ACb8444c3013dc40518e46b48c91f82ba0" withAuthToken:@"AUe90abecac85645ca8a314d41e9b55079"];

                            [everyoneAPI getInformation:EveryoneAPIReturnAllInfo forPhoneNumber:@"5551234567" withSuccessHandler:^(EveryoneAPIResponseObject *responseObject){
                                } withErrorHandler:^(NSError *error, NSNumber *statusCode, NSString *readableError){
                            }];
                       DESC
  s.homepage         = "https://github.com/msencenb/EveryoneAPI"
  s.license          = 'MIT'
  s.author           = { "Matt Sencenbaugh" => "[email protected]" }
  s.source           = { :git => "https://github.com/msencenb/EveryoneAPI.git", :tag => s.version.to_s }

  s.ios.deployment_target = "8.0"
  s.osx.deployment_target = "10.9"
  s.requires_arc = true

  s.source_files = 'Pod/Classes'
  s.resource_bundles = {
    'EveryoneAPI' => ['Pod/Assets/*.png']
  }
end

It's a simple pod that uses only Foundation classes, so it shouldn't need separate resources. All well and good, but during pod lib lint I get the following error:

 - NOTE  | [OSX]  error: /var/folders/yd/kfjb5s4d1vv57fv5lhtm9lbh0000gn/T/CocoaPods/Lint/build/Release/EveryoneAPI.bundle: No such file or directory

It kind of makes sense, my EveryoneAPI.bundle target in the development section of Xcode is setup to create an iOS bundle. I can't for the life of me figure out how to get the pod to target OSX. Are there any good guides? Do I add a new target? If so, how do I tell the podspec to look for that specific bundle rather than the iOS one?

like image 836
Msencenb Avatar asked Aug 19 '15 04:08

Msencenb


1 Answers

You can add

s.platform = :osx, '10.7'
s.platform = :ios, '6.0'

to your Podspec and like I'L'I suggested, you should specify the source file as well as your pod lint error is that it doesn't find the sources.

s.osx.source_files = "Classes/osx/**/*.{h,m}"

If your everyoneAPI is a module, you can also add it this way :

s.osx.frameworks = 'everyoneAPI'

And if it's a library you can add it this way :

s.vendored_libraries = 'Vendor/everyoneAPI/everyoneAPI'
like image 165
Loegic Avatar answered Oct 14 '22 05:10

Loegic