Uploading library to cocoa pods - cocoa

I have created a library in Swift and is trying to upload the library to cocoapods(I am not sure if this is possible, but I assume it has to be). I have never uploaded a library to cocoapods before, so I am unaware of how to do this. I already have the library up in GitHub.
This is what I tried:
Opened the terminal and typed in the following command:
pod spec create JHProgressHUD
This created a JHProgressHUD.podspec file. I replaced the entire default contents of the file with the following:
Pod::Spec.new do |spec|
spec.name = 'JHProgressHUD'
spec.version = '1.0.0'
spec.license = { :type => 'MIT' }
spec.homepage = 'https://github.com/harikrishnant1991/JHProgressHUD'
spec.authors = { 'Harikrishnan T' => 'harikrishnant1991#yahoo.com' }
spec.summary = 'IOS HUD Swift Library'
spec.source = { :git => 'https://github.com/harikrishnant1991/JHProgressHUD.git', :tag => '1.0.0' }
spec.ios.deployment_target = '7.0'
spec.platform = :ios, '7.0'
spec.source_files = 'JHProgressHUD.swift'
end
Then I tried the following command:
pod spec lint JHProgressHUD.podspec
But I am getting the following error:
-> JHProgressHUD (1.0.0)
- ERROR | [xcodebuild] error: /Applications/Xcode 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker
Analyzed 1 podspec.
[!] The spec did not pass validation.
What is causing this error? Since this is the first time I am trying to add a library to cocoapods, I am not sure if this is happening since this is a swift library. I have tried the library in a project and it is compiling and running fine. Can anyone guide me on how to add a library to cocoapods? I have found only a few number of tutorials and none of them was much helpful. Is it possible to add a swift library to cocoapods?

I don't know if the same problem with you
Error when compiling a static library using Swift "unknown option character `X' in: -Xlinker"
https://github.com/CocoaPods/CocoaPods/issues/2226
they still working on it https://github.com/CocoaPods/CocoaPods/issues/2272
there is an alternative for upload your swift library
http://www.swifttoolbox.io/
https://www.cocoacontrols.com/

Related

dyld: Library not loaded: #rpath/SwiftyStoreKit.framework/Versions/A/SwiftyStoreKit - macCatalyst

Run fails with the error for mac Catalyst
require 'cocoapods-catalyst-support'
platform :ios, '10.0'
target 'MyApp' do
use_frameworks!
pod 'SwiftyStoreKit'
end
# Configure your macCatalyst dependencies
catalyst_configuration do
# Uncomment the next line for a verbose output
verbose!
# ios '<pod_name>' # This dependency will only be available for iOS
# macos '<pod_name>' # This dependency will only be available for macOS
end
post_install do |installer|
installer.configure_catalyst
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'Yes'
end
end
end
end
This is my podfile ,ya this contains more pods other. than SwiftyStoreKit.
i am able to run without the SwiftyStoreKit, but if i add at then getting this error and breakpoint
dyld: Library not loaded: #rpath/SwiftyStoreKit.framework/Versions/A/SwiftyStoreKit
Referenced from: /Users/admin/Library/Caches/...../Build/Products/Debug-maccatalyst/MyApp.app/Contents/MacOS/MyApp
Reason: image not found
i am using this tool to exclude pods for mac catalyst: https://github.com/fermoya/cocoapods-catalyst-support
using
Xcode : 12.4
macOS : Big Sur 11.2.2
Integrating SwiftStoreKit with Swift Package Manager solves the issue.
If you are using Xcode 11 or later:
Click File
Swift Packages
Add Package Dependency...
Specify the git URL for SwiftyStoreKit.
https://github.com/bizz84/SwiftyStoreKit.git

'RCTBridgeModule.h' file not found

I using expo version of react native 0.48.4 (21.0.2 expo) and react-native-in-app-utils#5.6.0. When I link using react-native install react-native-in-app-utils.
Till now I have tried:
Manually Linking
Deleting node_modules and installing again
Including react to the build scheme with parallelized build unchecked
Tried to add react to search header path
But still, the stubborn error does not go away.
My pod definition for react is like so:
pod 'React',
:path => "../node_modules/react-native",
:subspecs => [
"Core",
"BatchedBridge",
"ART",
"RCTActionSheet",
"RCTAnimation",
"RCTCameraRoll",
"RCTGeolocation",
"RCTImage",
"RCTNetwork",
"RCTText",
"RCTVibration",
"RCTWebSocket",
"DevSupport",
"CxxBridge"
]
Can some help me?
I got it working by installing the lib from cocapods instead of linking it by react native like so:
pod ‘react-native-in-app-utils’,
:git => “https://github.com/chirag04/react-native-in-app-utils”
Hope this is helpful to anyone.

Lint Error for pod library Swift 4 Xcode 9

I'm creating a pod for my swift 4 for library.
I run pod lib create IntentedLibraryName which generates the workspace. Then I did the necessary modifications to the files IntentedLibraryName.podspec, and moving my library swift files to the path IntentedLibraryName/Classes/.
To test out if the pod works, I've Build and pod install from the Example project and everything works as intended.
Now, I run pod lib lint IntentedLibraryName.podspec --verbose then I got
(1 failure) === BUILD TARGET IntentedLibraryName OF PROJECT Pods WITH CONFIGURATION Release ===
Check dependencies The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor. The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor
I did the following hoping it would fix it:
In the Pod project, From Build Settings > Swift Compiler- Language > Swift Language Version from Swift unspecified to Swift 4.0.
I added and committed all changes along the tag (i.e git tag 0.0.1) and push all it with --tags. (i.e git push -u origin dev --tags)
I run the linting command again, and still the same issue.
I even try toecho 4.0 > .swift-version save all commit and push it again. NADA
Also tried s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' } NADA
## CocoaPods Environment
ℹ Please replace this with the output of `pod env`.
e.g. via `pod env | pbcopy`
### Stack
```
CocoaPods : 1.4.0.beta.1
Ruby : ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16]
RubyGems : 2.5.1
Host : Mac OS X 10.12.6 (16G1023)
Xcode : 9.0 (9A235)
Git : git version 2.8.1
Ruby lib dir : /Users/lamour/.rvm/rubies/ruby-2.3.0/lib
Repositories : bahlo - https://github.com/bahlo/SwiftGif # d26325392aefe7822dea79a757d4e300c694d010
master - https://github.com/CocoaPods/Specs.git # f2169476eead8b1a9d898ff73c5eba516504ed78
```
### Installation Source
```
Executable Path: /Users/lamour/.rvm/gems/ruby-2.3.0/bin/pod
```
### Plugins
```
cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.3.0
cocoapods-try : 1.1.0
```
Project that demonstrates the issue
Please link to a project we can download that reproduces the issue.
You can delete this section if your issue is unrelated to build problems,
i.e. it's only an issue with CocoaPods the tool.
I do think its an issue with Xcode 9.0 because I've created empty project, still same thing happened.
Thanks for the help :)
Issue Fixed
The issue had nothing to do with Xcode 9 but it was with cocoapods. I did uninstall cocoapods from my machine and install it again. Once you done make sure you had the echo 4.0 > .swift-version. Voila :)
echo 4.0 > swift-version
should be
echo 4.0 > .swift-version
right (NB the leading dot)?
I had the same problem and for whichever reason, in my .swift-version file there was a strange
2.4 =>
in it (sic).
After I changed it to
4.0
, everything worked.
Example project here:
https://github.com/karstengresch/CleanroomLogger (actually a dumb fork of CleanRoomLogger which I want to use with Cocoapods).

dyld: Library not loaded: #rpath/ ... Reason: image not found with a simple Hello world applicat

I am running into some trouble when trying to use SwiftCSV using CocoaPods and following the basic instructions.
After creating the simple Hello world console application for OS X from the template in XCode 7.3.1, I opened a terminal window and navigated to the project folder and issued a pod init
I then edited Podfile by adding the line below in the target section:
pod "SwiftCSV"
I then executed pod install, which completed successfully.
After loading the resulting .xcworkspace in XCode, when I run the application, I get the following error:
dyld: Library not loaded: #rpath/SwiftCSV.framework/Versions/A/SwiftCSV
Referenced from: /Users/paolomarini/Library/Developer/Xcode/DerivedData/BundleGeneratorSwift-egsxgxpdiuvqrfddzyzcxnwltulk/Build/Products/Debug/BundleGeneratorSwift
Reason: image not found
Program ended with exit code: 9
Note that I didn't specify a platform in Podfile as I can't figure out what the correct value is for OS X. The Podfile is as below:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'BundleGeneratorSwift' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for BundleGeneratorSwift
pod "SwiftCSV"
end
Thanks,
Paolo

SQLite.swift unknown type name 'NS_ASSUME_NONNULL_BEGIN'

I'm using SQLite.swift. There's an error "Unknown type name 'NS_ASSUME_NONNULL_BEGIN'" when I build the project.
What I do:
create a demo project 'SqlDemo'
under SqlDemo/, create Podfile
use_frameworks!
source 'http://git.oschina.net/akuandev/Specs.git'
pod 'SQLite.swift', git:'https://github.com/stephencelis/SQLite.swift.git'
# pod 'SQLite.swift/Cipher', git: ... # instead, for SQLCipher support
~
then 'pod install'
after that open SqlDemo.xcworkspace
build the project
this maybe a pretty simple error. I'm new to ios dev.

Resources