up9cloud / ios-libtdjson

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ios-libtdjson

Version License Platform

Lib versions

pod tdlib
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)

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 commit id for tdlib in ./build.sh
  • Update the Lib versions part in ./README.md
  • Commit and add tag git tag vx.x.x
  • Push
  • Wait for CI build task

Manually do pod trunk push if CI build failed...

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

what if need commit more fixing things...

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

About

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

License:MIT License


Languages

Language:Shell 59.1%Language:Swift 20.8%Language:Ruby 20.1%