Cocoapods not showing my project as Tested - ios

I have a project that I've added as a Cocoapod. It is covered by tests, yet the Cocoapods project page does not show the tests. Here is the link to my project page:
https://cocoapods.org/pods/SKTableViewDataSource
Note, Tested: X in the right hand column.
This is what my podspec looks like:
Pod::Spec.new do |spec|
spec.name = 'SKTableViewDataSource'
spec.version = '1.0.0'
spec.license = 'MIT'
spec.summary = 'An easy to configure data source for UITableView.'
spec.homepage = 'https://github.com/skladek/SKTableViewDataSource'
spec.authors = { 'Sean Kladek' => 'skladek#gmail.com' }
spec.source = { :git => 'https://github.com/skladek/SKTableViewDataSource.git', :tag => spec.version }
spec.ios.deployment_target = '9.0'
spec.source_files = 'Source/*.swift'
end
Do I need to add something to the podspec or elsewhere to have it recognize my tests?

From a ticket in the cocoadocs.org project:
Apparently it comes from the © character in the headers added by Xcode when creating a new Swift file, like in the following line:
// Copyright © 2017 pirishd. All rights reserved.
Removing this character in all the Swift files of the Test target makes detection work again.
https://github.com/CocoaPods/cocoadocs.org/issues/523
Removing the copyright headers from my test files worked for me.

Related

Create CocoaPod framework with Kotlin shared.framework

I've created a SDK framework and added all files (Swift, Objective C and c++). Also added shared.framework which is written in Kotlin(KMM).
I linked SDK framework into dummy project and working correctly.
Now I've to deliver SDK framework to cocoapod. So for that I've created PodSpec file inside SDK framework and installed it to demo project. It installed successfully, but can't access header files (Objective C) in swift file.
Here is my PodSpec file.
Pod::Spec.new do |spec|
spec.name = "DemoSDKSwift"
spec.version = "0.0.1"
spec.summary = "A short description of DemoSDKSwift."
spec.description = "A very long description of DemoSDKSwift."
spec.homepage = "https://BITBUCKET_URL.COM/DemoSDKSwift"
spec.source = { :git => "https://BITBUCKET_URL.COM/DemoSDKSwift.git", :tag => "#{spec.version}" }
spec.license = "MIT"
spec.author = { "Author Name" => "AuthorName#streamplate.com" }
spec.source_files = "DemoSDKSwift/**/*"
spec.platform = :ios, "15.0"
spec.ios.deployment_target = '15.0'
spec.vendored_frameworks = 'Frameworks/shared.framework'
spec.libraries = 'c++', 'sqlite3', 'z', 'stdc++'
spec.pod_target_xcconfig = {
'KOTLIN_PROJECT_PATH' => ':shared',
'PRODUCT_MODULE_NAME' => 'shared',
}
end
I also have added Bridging header file but it's not working.
I tried so many solutions, but couldn't figure out. Please help to make it working.

Resource file in cocoapod is set to a wrong target

I have a public CocoaPod called CountrySelectorView. It's basically a small library that allows users to select countries from a list. This list of countries is included as a json file in the pod.
I released the first version (v0.1.0) a few months ago and it worked well without an issue. Today I added some new changes to the codebase and released a new version (v0.1.2).
When I install this new version now, the countries.json file is assigned a weird target.
And this affects only that json file. All other files are set to the proper target.
This is my podspec file. The only thing I changed here was the version string before publishing the new version. No changes were done to the countries.json file either apart from some minor content changes.
Pod::Spec.new do |s|
s.name = 'CountrySelectorView'
s.version = '0.1.2'
s.summary = 'CountrySelectorView lets users pick a country from a list.'
s.description = <<-DESC
CountrySelectorView lets users pick a country. You can show it either as a list where you can search or a picker view.
DESC
s.homepage = 'https://github.com/Isuru-Nanayakkara/CountrySelectorView'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Isuru-Nanayakkara' => '<my_email>' }
s.source = { :git => 'https://github.com/Isuru-Nanayakkara/CountrySelectorView.git', :tag => s.version.to_s }
s.ios.deployment_target = '11.0'
s.source_files = 'CountrySelectorView/Classes/**/*'
s.resource_bundles = {
'CountrySelectorView' => ['CountrySelectorView/Assets/countries.json']
}
s.frameworks = 'UIKit'
s.swift_version = '5.0'
end
Strange thing is when I install the old version (v0.1.0) now, this problem arises in that version as well! Prior to today, it worked fine.
Any idea what may have caused this?
Demo project

How to distribute compiled framework using Cocoapods?

I'm building a framework using cocoapods. Now, I have it in a private repository with a private spec repo. I want to distribute this framework not as open source, but closed source. Basically, I want to distribute only the .framework file, already compiled. This way, I will avoid to expose my source code to externals.
I don't know how to tell cocoapods to distribute the compiled file.
After compiling your framework, you'll want to create a separate, public repository to use for distribution. That is where you will place your compiled framework, podspec, license, readme files, etc.
The podspec is a bit different for distributing frameworks rather than source code. See example:
Pod::Spec.new do |s|
s.name = 'YourFrameworkName'
s.version = '1.7.0'
s.summary = 'The YourFrameworkName iOS SDK enables you to embed state-of-the-art real-time goodness into your iOS app.'
s.homepage = 'http://example.com'
s.author = { 'Name' => 'info#example.com' }
s.license = { :type => 'Custom', :file => 'LICENSE' }
s.platform = :ios
s.source = { :http => 'https://github.com/example/YourFrameworkName/releases/download/1.7.0/YourFrameworkName.zip' }
s.ios.deployment_target = '9.0'
s.ios.vendored_frameworks = 'YourFrameworkName.framework'
s.dependency 'SwiftyJSON', '3.1.4'
end
Once all that is set up, you can publish the pod spec the normal way.
Keep in mind, and this is an important consideration, that your compiled framework written in Swift will only be usable in projects that use the exact same Swift version. You will quickly run into this limitation as people start using your framework in different projects with various Swift versions.
First, you create a sample project and install the pods(the library which you want to release as SDK.framework) for the project.
Then see the below-attached image to get the .framework extension file to distribute to the public.
You can do this by pointing s.source of the podspec file to a zip file of your framework and its source. No need to expose your source in a public repository.
ex.
spec.source = { :http => 'https://bitbucket.org/publicRepo/yourframework.zip' }

Trying to wrap vendor framework in cocoapod but the compiler can't find headers

Hoping somebody has already solved this; I'm trying to wrap a third-party library (Airwatch) in a cocoapod for better management across our apps. I'm having a hell of a time trying to get this to work, though. I've created a pod around a static library, but this one is a dynamic framework, and I'm having a hell of a time getting it to compile. The headers from the framework just aren't accessible in the containing app....
Here's what I have tried already:
When I set vendored_libraries in podspec i can't seem to access headers with either quotes or <>. Xcode just complains as 'Not Found'
Next, I tried adding the path of the headers in the framework as source_files like so
s.source_files = 'Pod/Classes/**/*','Pod/Framework/AWSDK.framework/Versions/A/Headers/*.h'
This allows xcode to find the header for an import like:
import "AWSDKCore.h" //Documented as the framework's main header
But this throws an error for the existing imports within the original framework:
I figured this was a bad idea, but I thought I'd try naming my cocoapod the same name as the Framework (which should keep the import path). So, this throws a bunch of errors saying some enums either aren't declared or are declared twice.
If anybody has thoughts, I'd be eternally greatful...
Just for reference here's my podspec:
Pod::Spec.new do |s|
s.name = "AirwatchSDK"
s.version = "0.1.0"
s.summary = "A short description of AirwatchSDK."
s.homepage = "https://github.com/<GITHUB_USERNAME>/AirwatchSDK"
s.license = 'MIT'
s.author = { "xxxxx" => "xxxx" }
s.source = { :git => "https://github.com/<GITHUB_USERNAME>/AirwatchSDK.git", :tag => s.version.to_s }
s.platform = :ios, '8.0'
s.requires_arc = true
#s.module_name = 'AWSDK'
s.source_files = 'Pod/Classes/**/*','Pod/Framework/AWSDK.framework/Versions/A/Headers/*.h'
s.vendored_frameworks = 'Pod/Framework/AWSDK.framework'
s.frameworks = 'CFNetwork','CoreData','CoreFoundation','CoreGraphics','CoreLocation','CoreTelephony','CoreText'
s.libraries = 'stdc++','z','sqlite3','c++'
end
Since I figured out my own answer, I thought I'd post it here for the next guy...
The key, it turns out, was to not have 'source_files' (or to comment it out). I'm not sure if that is a bug or not, but my final podspec had vendored_framework set and source_files not set like so:
#can't have source files if you want to access vendor framework
#s.source_files = 'Pod/Classes/**/*'
# airwatch framework.
s.vendored_frameworks = 'AWSDK.framework'

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
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.

Resources