/ios-libtdjson

Prebuilt [TDLib](https://github.com/tdlib/td) shared lib (libtdjson.dylib) for iOS and macOS

Primary LanguageShellMIT LicenseMIT

ios-libtdjson

Version License Platform

Lib versions

pod tdlib
0.4.2 1.8.31
0.4.1 1.8.30
0.3.0 1.8.7
0.2.2 1.8.1
0.2.1 1.7.9
0.2.0 1.7.0

Supported architectures

Platform Architecture
iOS armv7
armv7s
arm64
iOS simulator i386
x86_64
arm64 (M1↑)
macOS i386
x86_64
arm64 (M1↑)
watchOS armv7k
arm64_32
arm64
watchOS simulator x86_64
arm64
tvOS arm64
tvOS simulator x86_64
arm64
visionOS arm64
visionOS simulator x86_64
arm64

Installation

CocoaPods

libtdjson is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'libtdjson'

or add it to your .podspec file:

Pod::Spec.new do |s|
  s.dependency 'libtdjson'
end

Use it as module (iOS, swift)

Because this pod only provide .dylib files (to prevent module name conflicts and keep it simplest!), if you want to use it as module (e.q. on iOS with swift), you have to add some necessary files:

  • Download example headers and module.modulemap
curl -SLO https://github.com/up9cloud/ios-libtdjson/releases/download/v0.2.2/cocoapod_modulemap.tar.gz
mkdir include
tar xzf cocoapod_modulemap.tar.gz -C include

# Edit files to whatever you want, e.q. change the module name or remove export symbols you don't need
  • Add include path and link lib, e.q.
Pod::Spec.new do |s|
  s.pod_target_xcconfig = {
    'SWIFT_INCLUDE_PATHS' => '${PODS_TARGET_SRCROOT}/include',
    'OTHER_LDFLAGS' => '-ltdjson',
  }
end
  • Use it
import libtdjson
func create() -> Int {
    return Int(bitPattern: libtdjson.td_json_client_create()!)
}
// ... (more usages at ./example/*)

Carthage

TODO:

Manually

Download prebuilt files from Release, then do whatever you want.

Q&A

An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain,code=1):

The app will crash if identification name of .dylib isn't correct

# check id
otool -D libtdjson.dylib

# fix id
install_name_tool -id @rpath/libtdjson.dylib libtdjson.dylib

TODO

  • Package static lib for App Store
  • Support Carthage
  • Support M1 (Apple Silicon) - migrate to XCFramework, see PR 1620

Dev memo

Bump the TDLib version

  • Modify the version for git checkout in ./build.sh
  • Update the Lib versions part in ./README.md
  • Git commit (message example: bump td to vx.x.x)
  • Git add tag (git tag vx.x.x, the tag version should be the version on cocoapod)
  • Push with tags (git push && git push --tags)
  • Wait for CI task

If the CI build failed, need manually do pod trunk push...

export GITHUB_REF=refs/tags/<the version>
pod trunk push --allow-warnings libtdjson.podspec
pod trunk push --allow-warnings flutter_libtdjson.podspec

Find pod info

pod trunk info libtdjson

what if need to revert the tag...

version=<the version tag>
git push --delete origin $version
git tag -d $version
git add .
git commit -m "..."
git tag $version
git push && git push --tags