"Cannot find interface declaration for 'NSObject'" when linting my podspec - ios

I am trying to create an update for the jre_emul podspec, as version 0.7.2 is outdated now.
Using the original podspec file I learned a lot about the podspec format. With the update though, I am trying a different approach: I want to use the binary distribution of J2ObjC as a source for the podspec.
The current state of the podspec including the used sources can be found on GitHub.
When I try to validate the podspec from the repository, I get the following errors:
- ERROR | [xcodebuild] jre_emul/include/NSObject+JavaObject.h:31:12: error: cannot find interface declaration for 'NSObject'
- ERROR | [xcodebuild] jre_emul/include/NSObject+JavaObject.h:49:4: error: expected a type
- ERROR | [xcodebuild] jre_emul/include/NSObject+JavaObject.h:51:4: error: expected a type
- ERROR | [xcodebuild] jre_emul/include/NSObject+JavaObject.h:60:19: error: use of undeclared identifier 'NSObject'
- ERROR | [xcodebuild] jre_emul/include/IOSArray.h:31:34: error: cannot find protocol declaration for 'NSCopying'
- ERROR | [xcodebuild] jre_emul/include/IOSArray.h:31:23: error: cannot find interface declaration for 'NSObject', superclass of 'IOSArray'
If I remove the "jre.source_files" line and add the header files to the "jre.preserve_paths" line it validates correctly since no files are being compiled.
I can use that podspec in another project, but I have to manually add the "jre_emul/include" dir to the Header Search Paths, which is not desirable in my opinion.

Related

pod spec lint or pod lib lint fails while updating cocoapods library

I'm trying to update my GLNotification cocopods version.
I had switched over from Xcode 9.4 -> Xcode 10. I had converted my code to latest swift version, after that i'm unable to update my pods.
But there is no warning or error in my code. It works fine. Download my code here .
My Pods Spec
Pod::Spec.new do |s|
s.name = 'GLNotificationBar'
s.version = '2.3.6'
s.summary = 'GLNotificationBar lets user to handle push notification when app is active.'
s.description = <<-DESC
GLNotificationBar is a open source library that lets developers to display push notification or any alert message to end user as banner. iOS below 10 does't displays notification when app is active. This library is inspired by Apple's ios10 notification bar.
DESC
s.homepage = 'https://github.com/gokulgovind/GLNotificationBar'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'gokul' => 'gokulece26#gmail.com' }
s.source = { :git => 'https://github.com/gokulgovind/GLNotificationBar.git', :tag => s.version.to_s }
s.ios.deployment_target = '10.0'
s.source_files = 'GLNotificationBar/Classes/**/*'
s.resource_bundles = {
'GLNotificationBar' => ['GLNotificationBar/Classes/*.xib','GLNotificationBar/Assets/*.png']
}
s.frameworks = 'UIKit'
end
Error
-> GLNotificationBar (2.3.6)
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:247:59: error: type 'UIWindow' has no member 'Level'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:278:44: error: type 'NSAttributedString' has no member 'Key'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:323:69: error: type 'UIWindow' has no member 'Level'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:419:115: error: type 'UIResponder' has no member 'keyboardWillShowNotification'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:420:114: error: type 'UIResponder' has no member 'keyboardWillHideNotification'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:486:44: error: type 'NSAttributedString' has no member 'Key'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:487:44: error: type 'NSAttributedString' has no member 'Key'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:489:44: error: type 'NSAttributedString' has no member 'Key'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:527:64: error: type 'UIControl' has no member 'State'
- NOTE | xcodebuild: UIKit.UIControl:16:14: note: did you mean 'state'?
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:528:90: error: type 'UIControl' has no member 'Event'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:744:55: error: type 'UIWindow' has no member 'Level'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:813:80: error: type 'UIView' has no member 'AnimationOptions'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:916:33: error: type 'UITextField' has no member 'BorderStyle'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:920:38: error: type 'UIControl' has no member 'State'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:922:67: error: type 'UIControl' has no member 'State'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:990:47: error: type 'UIWindow' has no member 'Level'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:1005:43: error: type 'UIResponder' has no member 'keyboardFrameEndUserInfoKey'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:1018:43: error: type 'UIResponder' has no member 'keyboardFrameEndUserInfoKey'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:1123:27: error: type 'NSAttributedString' has no member 'Key'
- ERROR | xcodebuild: GLNotificationBar/GLNotificationBar/Classes/GLNotificationBar.swift:1132:27: error: type 'NSAttributedString' has no member 'Key'
Fix I Tried
Added s.swift_version = '4.1' in my GLNotificationBar.podspec
Changed Swift Language Version to 4.2 in Build Settings
Updated iOS deployment target from iOS 8 to iOS 10
Terminal Command I Tried
pod spec lint GLNotificationBar.podspec
pod spec lint
pod spec lint --allow-warnings
Have you tried updating the Swift language version in your pod spec?
It might be a compilation issue for mismatched language versions.
This is your latest commit and it's still set to an earlier version of Swift than the project settings.
As you moved to X-Code 10, it supports swift 4 and 4.2 as of now, so you need to have same in build settings as well as in Pods Spec.
If you are not using swift 3,4 and 4.2 then need to go to File->Workspace Setting
and select build system to Legacy Build System.
You need to commit everything and push to git.
Update tag to new version and push to tag.
Then try to push to Cocoapods pod trunk push --allow-warnings.
Let me know if you get any issues after you try this.
Thanks.

#import "sqlite3.h" from a pod's source

I have a private podspec for a library that relies on Apple's sqlite3.h. Unfortunately, it fails lint:
- ERROR | xcodebuild: Returned an unsuccessful exit code. You can use `--verbose`
for more information.
- ERROR | xcodebuild: /Users/tewha/Library/Developer/Xcode/DerivedData
/App-cglpwsgirxhgugbbcytbhfqnbjrw/Build/Products/Release-iphonesimulator
/SQLPackRat/SQLPackRat.framework/Headers/SQLPRDatabase.h:10:9: error: include of
non-modular header inside framework module 'SQLPackRat.SQLPRDatabase':
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform
/Developer/SDKs/iPhoneSimulator10.3.sdk/usr/include/sqlite3.h' [-Werror,
-Wnon-modular-include-in-framework-module]
Unfortunately, there doesn't seem to be a modular include for sqlite3.h.
How do I fix this? It seems to work anyway, but I imagine this will cause trouble for me later (probably as I start to use Swift in this project).

Private Swift Pod with ObjC static libraries

I am trying to create a private pod that ships with two static libraries.
Source of the pod is in swift however it depends upon two third party static libraries on which I have no control.
Linting my podspec, I get the following error just for the second lib (with a modulemap)
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
- ERROR | xcodebuild: TestKit/TestKit/SSAIPolicy.swift:11:8: error: no such module 'SecondLib'
And, here is the source part of my podspec file:
spec.source_files = 'TestKit/*', 'Vendor/**/*.{h,modulemap}'
spec.vendored_libraries = 'Vendor/FirstLib/libService.a', 'Vendor/SecondLib/libManagement.a'
spec.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-ObjC' }
Note: I am able to use this framework just fine by compiling and dropping it manually in the main app
In case anyone needs to know, I got it working by changing 'Target Membership'
of header files in my library from 'Project' to 'Public'

Creating CocoaPod, get error I can't solve about missing file (that is there)

I am trying to create a pod (first one) for this project:
https://github.com/xeppen/GLLingoManager
I run $ pod spec lint GLLingoManager.podspec and I get an error.
-> GLLingoManager (0.1.0)
- ERROR | xcodebuild: Returned an unsuccessful exit code.
- NOTE | xcodebuild: GLLingoManager/Classes/GLLingoManager.m:10:9: fatal error: 'GLNetworkService.h' file not found
I am checking the files and all seem correct. Demo project works etc.
How can I solve this? I dont understand why it says its wrong.
If you use SDK, I think you need to create subspec and specify search paths for each of the SDK may giving issues, for example :
s.subspec "Kairos" do |ss|
ss.dependency "Kairos", "~> 2.1"
ss.xcconfig = { "FRAMEWORK_SEARCH_PATHS" => "$(PODS_ROOT)/Heyzap"}
end

Pod spec lint error due to CocoaLumberjack subspec

Week ago I've pushed MyApp to my private cocoapods without any problems. I did not update anything with CocoaLumberjack in the meantime.
My podspec contains:
spec.subspec 'Core' do |cs|
cs.dependency 'libextobjc', '~> 0.4'
cs.dependency 'CocoaLumberjack', '2.0.0-rc2'
end
And here is the command && error:
$ pod repo push my-private MyApp.podspec
Validating spec
-> MyApp (0.0.7)
- NOTE | [MyApp/Core] [xcodebuild] CocoaLumberjack/Classes/DDASLLogger.m:85:31: warning: implicit declaration of function 'geteuid' is invalid in C99 [-Wimplicit-function-declaration]
- ERROR | [MyApp/Core] [xcodebuild] CocoaLumberjack/Classes/DDASLLogger.m:85:31: error: conflicting types for 'geteuid'
- NOTE | [MyApp/Core] [xcodebuild] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/include/unistd.h:445:8: note: previous declaration is here
[!] The `MyApp.podspec` specification does not validate.
Where line 85 of that file is:
uid_t const readUID = geteuid();
It has been working before. I have no idea what have changed that it isn't working now.
Seems to fix itself after upgrading to Cocoapods version 0.36.0

Resources