Adding libcurl

I want to use libcurl with openSSL support for my iOS and MacOS apps.

I checked the project's Build Phases - Link Binary with Libraries, and saw that it's possible to add libcurl.tbd, libcurl.3.tbd and libcurl.4.tbd

Is it OK to use one of those libraries instead of compiling the libcurl by myself?

And if it's OK - which one should I include? because the current libcurl versions are starting with 7 (not 3 or 4)

Technically you are always running a little bit of a risk when linking to an Apple-provided open-source library like that. It was built for Apple's use, not yours. There is no guarantee that it will work for your uses. I have seen cases where the Apple-provided lib (sqlite in my case) didn't handle my funky use case but a custom-compiled one did. With libcurl, you also have SSL to worry about so that may work for you or against you. No way to tell really. You will need to be dillgent about testing. Even if Apple has connected all the dots with SSL support today, they might neglect to keep that up by next year.


I can tell you that versions 3 and 4 are the same. Version 3 just symlinks to 4. I don't know the reason for the numbering. They are all version 7.54 or newer.

Accepted Answer

I want to use libcurl with openSSL support for my iOS and MacOS apps.

libcurl is considered API on macOS but not on iOS. For something to be API it needs to have both the headers and the stub libraries (nowadays these are

.tbd
files). Those criteria are met on macOS but not on iOS.

I presume that you’re sharing code between the two platforms, in which case it’s probably easiest for you to compile your own version of this library.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Well, that sounds right so I guess I'll compile it myself.

Thanks!

You are presuming correctly, so I'll just compile it myself.

Thanks!

"Avoiding Common Networking Mistakes" (https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/CommonPitfalls/CommonPitfalls.html#//apple_ref/doc/uid/TP40010220-CH4-SW2) states that on iOS raw sockets are best avoided since, among other things, "using sockets directly using POSIX functions or CFSocket does not automatically activate the device’s cellular modem or on-demand VPN." Doesn't this caveat also apply to using libcurl on iOS?

Doesn't this caveat also apply to using libcurl on iOS?

It does, as least insofar as that statement is still accurate at all. I discuss this issue extensively in this thread.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Adding libcurl
 
 
Q