I'm in the process of 'converting' an Xcode framework into a Cocoapod. I've gotten pretty far into the process, but I cannot get the pod to lint. Its a bit of a hybrid project, using both ObjC and Swift, but it builds fine in Xcode, but not through lint, which makes me think something involving Cocoapods is screwy.
Error:
- ERROR | [OSX] xcodebuild: EonilFileSystemEvents/EonilFileSystemEvents/FileSystemEventMonitor.swift:17:43: error: use of undeclared type 'EonilFileSystemEventFlag'
- ERROR | [OSX] xcodebuild: EonilFileSystemEvents/EonilFileSystemEvents/FileSystemEventMonitor.swift:89:28: error: use of undeclared type 'EonilJustFSEventStreamWrapper'
- ERROR | [OSX] xcodebuild: EonilFileSystemEvents/EonilFileSystemEvents/FileSystemEventMonitor.swift:63:15: error: use of unresolved identifier 'EonilJustFSEventStreamWrapper'
- ERROR | [OSX] xcodebuild: EonilFileSystemEvents/EonilFileSystemEvents/FileSystemEventMonitor.swift:138:14: error: use of unresolved identifier 'NSStringFromFSEventStreamEventFlags'
EonilFileSystemEvents.podspec:
#
# Be sure to run `pod spec lint rebekka.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#
Pod::Spec.new do |s|
s.name = "EonilFileSystemEvents"
s.version = "0.0.4"
s.summary = "Dead-simple access to FSEvents framework for Swift."
s.description = "Provides dead-simple access to FSEvents framework for Swift by Hoon H."
s.homepage = "https://github.com/128keaton/FileSystemEvents"
s.license = "MIT License"
s.author = "Hoon H"
s.frameworks = 'CoreServices', 'EonilFileSystemEvents'
s.requires_arc = true
s.osx.deployment_target = "10.10"
s.source = { :git => "https://github.com/128keaton/FileSystemEvents", :tag => "0.0.4" }
s.source_files = "EonilFileSystemEvents/*.{h,m}"
s.source_files = 'EonilFileSystemEvents/*.swift'
end
Project:
https://github.com/128keaton/FileSystemEvents
Use:
s.source_files = "EonilFileSystemEvents/*.{h,m}", 'EonilFileSystemEvents/*.swift'`
instead of:
s.source_files = "EonilFileSystemEvents/*.{h,m}"
s.source_files = 'EonilFileSystemEvents/*.swift'
Related
I'm trying to add below as dependencies together for my CocoaPod (installing either one works but cannot install both)
s.dependency 'TensorFlowLiteSwift'
s.dependency 'LibTorch-Lite'
'LibTorch-Lite' requires below spec
s.static_framework = true
s.pod_target_xcconfig = {
'HEADER_SEARCH_PATHS' => '$(inherited) ${PODS_ROOT}/LibTorch-Lite/install/include’,
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
}
s.user_target_xcconfig = {
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
}
because I get below error.
libtorch.a(empty.cpp.o), building for iOS Simulator, but linking in object file built for iOS, file '/var/folders/3x/x73_p70n2tg0gnwq9lct7rmr0000gn/T/CocoaPods-Lint-20221219-7300-1w8h64c-PyTorchTensorFlowCocoaPod/Pods/LibTorch-Lite/install/lib/libtorch.a' for architecture arm64
However spec 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' causes below error when installing TensorFlowLiteSwift.
main.swift:1:8: error: could not find module 'PyTorchTensorFlowCocoaPod' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, at: /Users/steve.ham/Library/Developer/Xcode/DerivedData/App-dnxlikhybfsytahdpnmquhblzyly/Build/Products/Release-iphonesimulator/PyTorchTensorFlowCocoaPod/PyTorchTensorFlowCocoaPod.framework/Modules/PyTorchTensorFlowCocoaPod.swiftmodule
Does anyone know how to install both CocoaPods as dependency? Thanks.
I am developing a private react-native library for ios.
The code is hosted on private git repo and accessible only to a few people.
The podspec file I have currently is something like this:
Pod::Spec.new do |s|
s.name = "SomeName"
s.version = "0.0.1"
s.summary = "SomeSummary"
s.description = <<-DESC
SomeDescription
DESC
s.homepage = "https://somehomepage.com"
s.platform = :ios, "9.0"
s.source_files = "*.{h,m}"
s.requires_arc = true
s.author = "someAuthor"
s.dependency "React"
end
The problem that I am having is that when I use the library on a local react-native app and do pod install, i get an error:
The `SomeName` pod failed to validate due to 1 error:
- WARN | attributes: Missing required attribute `license`.
- ERROR | attributes: Missing required attribute `source`.
- WARN | license: Missing license type.
- WARN | description: The description is equal to the summary.
What should the source be in this case?
source should specify the private github repo. See docs and examples here.
eg.
I have 'react-native-awesome' module, and ios file path is below
ios/RNAwesome/RNAwesome.h
ios/RNAwesome/RNAwesome.m
ios/RNAwesome.xcodeproj
I wrote podspec like below
require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
...some specification
s.source_files = "ios/*.{h,m}" //correct path is "ios/**/*.{h,m}"
...
end
It occur error when I use auto linking? (at RN > 0.60.x)
I am trying to create a Cocoapod. But when I run pod lib lint I get the below error:
MyCoolProject (1.0.0)
- ERROR | [iOS] public_header_files: The pattern includes header files that are not listed in source_files
Then it list out all my .h files. (Some removed for brevity)
/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/MyCoolProject.h,
/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/MyCoolProjectConstants.h,
/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/MyCoolProjectEnums.h,
/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/MyCoolProjectMacros.h,
/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/MyCoolProject_.h,
/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/UIView+MyCoolProjectPrivate.h,
/Users/myusername/Documents/GitHub/MyCoolProject/Pod/Classes/Objective-C/UIViewController+MyCoolProject.h
I have spent 2 days and found 0 information that helps me understand and correct the error. Can anyone shed some light on what I might be doing wrong?
Here is my podspec file
Pod::Spec.new do |s|
s.name = "MyCoolProject"
s.version = "1.0.0"
s.summary = "Color Framework for iOS (Obj-C & Swift)"
s.homepage = "https://github.com/myusername/MyCoolProject"
s.license = { :type => "MIT", :file => "LICENSE.md" }
s.author = "My Name"
s.platform = :ios
s.ios.deployment_target = '8.0'
s.source = { :git => "https://github.com/myusername/MyCoolProject.git",
:tag => s.version.to_s }
s.public_header_files = 'Pod/Classes/Objective-C/**/*.h'
s.frameworks = 'UIKit', 'QuartzCore', 'CoreGraphics'
s.default_subspecs = 'Default'
s.subspec 'Default' do |ss|
ss.source_files = 'Pod/Classes/Objective-C/**/*.{h,m}'
end
s.subspec 'Swift' do |ss|
ss.ios.deployment_target = '8.0'
ss.source_files = 'Pod/Classes/Swift/MyCoolProjectShorthand.swift'
ss.dependency 'MyCoolProject/Default'
end
end
As you can see from my screenshot all the files are there:
Does moving the public_header_files declaration into the Default subspec make a difference? Or moving source_files to the outer scope?
I suspect that CocoaPods is checking the files for Swift subspec before it processes its dependencies.
I have an Objective-C Library and I am trying to update the podspec to cocoapods. When I do the "pod spec lint" command I get the following error:
[!] The spec did not pass validation, due to 1 error.
[!] The validator for Swift projects uses Swift 3.0 by default, if you are using a different version of swift you can use a `.swift-version` file to set the version for your Pod. For example to use Swift 2.3, run:
`echo "2.3" > .swift-version`.
Here is my podspec file:
Pod::Spec.new do |s|
s.name = "OSwitch"
s.version = "0.2.0"
s.license = { :type => "MIT", :file => "LICENSE" }
s.summary = "OSwitch is a customisable switch control writen in Objective C."
s.homepage = 'https://github.com/OyaSaid/OSwitch'
s.source = { :git => 'https://github.com/OyaSaid/OSwitch.git', :tag => s.version.to_s }
s.platform = :ios, "7.0"
s.ios.frameworks = ['UIKit', 'Foundation']
s.source_files = 'OSwitch/Classes/**/*.{h,m}'
s.requires_arc = true
end
Why does this show when I have an objective C library. And how do I fix this?
Thanks
It shows that because you're able to use both swift and Objc languages in your pod.
Just run the following command in the terminal:
`echo "2.3" > .swift-version`
Replace "2.3" with your current Swift version in XCode, if you're on 3.1 for example replace it with "3.1". It will create a swift version file in your pod-project folder. And then you can run the lint command to validate your podspec.