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

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

Related

pod lib lint failed to validate a Kotlin multiplatform library

we are following the KMM documentation to build a very simple library available for our IOS and Android apps.
Following the sample project generated by android studio for a KMM library, we were able to install and intergrate manually the library built, in a IOS project.
Now we are trying to publish this library on cocoapod and make it available for installation.
The lib is called shared.. a shared.podspec is generated..
if we run
pod lib lint shared/shared.podspec --verbose
we have an error
`Testing with xcodebuild.
-> shared (0.3)
- WARN | url: The URL (https://github.com/OUR_REPO_URL) is not reachable.
- WARN | http: The URL (``) doesn't use the encrypted HTTPS protocol. It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. This will be an error in future releases. Please update the URL to use https.
- WARN | [iOS] license: Unable to find a license file
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
- NOTE | xcodebuild: note: Using new build system
- NOTE | xcodebuild: note: Using codesigning identity override: -
- NOTE | xcodebuild: note: Build preparation complete
- NOTE | [iOS] xcodebuild: note: Planning
- NOTE | [iOS] xcodebuild: note: Building targets in dependency order
- NOTE | [iOS] xcodebuild: warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')`
Scrolling up to the error I got:
`
/bin/sh -c /Users/andreadg/Library/Developer/Xcode/DerivedData/App-aamafucqqbvtfsfaselpdjormnrg/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/shared.build/Script-46EB2E000002E0.sh
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME -Pkotlin.native.cocoapods.archs="$ARCHS" -Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
FAILURE: Build failed with an exception.
* What went wrong:
Directory '/' does not contain a Gradle build.
A Gradle build should contain a 'settings.gradle' or 'settings.gradle.kts' file in its root directory. It may also contain a 'build.gradle' or 'build.gradle.kts' file.
To create a new Gradle build in this directory run 'gradlew init'
`
Project structure below
enter image description here
Any idea?
also
pod repo push fails
we tried to publish the library manually ignoring the lint , and it installed with no errors but it fails later during the build of the ios project.
kdoctor doesn't give any error. All good.

'pod lib lint' conflict between 'route.h' and <net/route.h>

I'm trying to run pod lib lint on a Cocoa Framework swift project and it returns the following error:
- ERROR | [iOS] xcodebuild: /MyProject/route.h:164:8: error: redefinition of 'rt_msghdr2'
- NOTE | [iOS] xcodebuild: /Applications/Xcode.app/Contents/Developer/Platforms
/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk
/usr/include/net/route.h:164:8:
note: previous definition is here
I have an Objective-C class (NetworkUtil.h - NetworkUtil.m) with the following import structure.
#if TARGET_IPHONE_SIMULATOR
#include <net/route.h>
#else
#include "route.h"
#endif
This, because route.h file only exist in the iOS Simulator SDK, but not in the actual iOS SDK (https://stackoverflow.com/a/23411469/5973853). I check whether it is an iPhone simulator, so the original < net/route.h > will be imported, or it runs on an actual iPhone, in that case it gets my manually copied 'route.h'.
Xcode manages to build and run the whole project correctly, but xcodebuild used by pod lib lint doesn't. For some reason, it imports both < net/route.h > and 'route.h' without considering the #if_TARGET_IPHONE_SIMULATOR validation and that makes the conflict due to "redefinition of several functions".
Is there any solution or workaround to this conflict?

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'

Can't debug my iOS project since updating to cocoa pods to use_frameworks! for Swift

After cocoapods 0.38.0 I updated my project to use_frameworks! so that I can make use of Swift modules.
Now whenever I try and debug via lldb I get the following error:
error: Error in auto-import:
failed to get module 'my-app-name' from AST context:
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Path/To/Project/Pods/Target Support Files/FBSDKCoreKit/FBSDKCoreKit-umbrella.h"
^
/Path/To/Project/Pods/Target Support Files/FBSDKCoreKit/FBSDKCoreKit-umbrella.h:6:9: note: in file included from /Path/To/Project/Pods/Target Support Files/FBSDKCoreKit/FBSDKCoreKit-umbrella.h:6:
#import "FBSDKAppLinkResolver.h"
^
/Path/To/Project/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkResolver.h:26:10: error: include of non-modular header inside framework module 'FBSDKCoreKit.FBSDKAppLinkResolver'
# import <Bolts/BFAppLinkResolving.h>
^
could not build Objective-C module 'FBSDKCoreKit'<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Path/To/Project/Pods/Target Support Files/FBSDKLoginKit/FBSDKLoginKit-umbrella.h"
^
/Path/To/Project/Pods/Target Support Files/FBSDKLoginKit/FBSDKLoginKit-umbrella.h:3:9: note: in file included from /Path/To/Project/Pods/Target Support Files/FBSDKLoginKit/FBSDKLoginKit-umbrella.h:3:
#import "FBSDKLoginButton.h"
^
A fatal parse error has occurred. LLDB may become unstable; please restart your debug session as soon as possible.
I did a bit of digging and found that if you set Allow Non-modular Includes in Framework Modules to yes for the FBSDKCoreKit target in the Pods project, that fixes the LLDB errors.

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

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.

Resources