mopidy-musicbox-webclient icon indicating copy to clipboard operation
mopidy-musicbox-webclient copied to clipboard

Go iOS: provide pod with just ObjectBox built for iOS/macOS

Open chzhong opened this issue 1 year ago • 2 comments

Describe the bug Objectbox-Swift 1.8.1 Pod still use Objectbox-C 0.18.0.

I don't know where is the best place to fire this new issue. See additional context for detail.

Basic info (please complete the following information):

  • ObjectBox version (are you using the latest version?): 1.8.1 (packed with Objecbox-C 0.18.0)
  • Reproducibility: always
  • Device: any iPhone
  • OS: any iOS

To Reproduce Steps to reproduce the behavior:

  1. Follow the instruction to install objectbox-swift
  2. Check Pods/ObjectBox/Objectbox.xcframework/ios-arm64/ObjectBox.framework/Headers/objectbox-c.h or call obx_version()

Expected behavior I should see Objectbox-Swift backing up by Objectbox-C 0.18.1.

Code not appliable

Logs, stack traces sig fault (detail see additional context)

Note: the loaded ObjectBox C library should be updated.
    Found ObjectBox version 0.18.0, but the minimum recommended version is 0.18.1

Additional context I'll explain the actual scenario here. I'm building an iOS app that requires a library built-on Go library (I'm also one of the developer of that Go library). We are using Objectbox-Go 1.7.0 (with requires Objectbox-C 0.18.1) in that Go library, and use gomobile to generate a iOS framework for the Go library. Since the Go library will fully maintain data, it is not applicable to move codes to iOS level (yes, we've planned Android and PC version that uses the same Go library)

First attempt, build the Xcode project without adding Objectbox-Swift as dependencies. Of course it would failed at link stage because Objectbox-Go requires Objectbox-C and it is not included in framework.

Second attempt, adding Objectbox to Podfile, and explicitly specify version 1.8.1. Build successfully completed because Objectbox-C (Objectbox.xcframework) is now included link options (via linking with Objectbox-Swift pod). Tried to run the app, but the app crashes, complaining

Note: the loaded ObjectBox C library should be updated.
    Found ObjectBox version 0.18.0, but the minimum recommended version is 0.18.1

There is no way to find any iOS-compliant ObjectBox-C binaries in releases.

I'd suggest to have two Pods for iOS:

  • ObjectBoxC, a pod that contains only macOS and iOS Objectbox-C frameworks, releases with ObjectBox-C.
  • ObjectBox or ObjectBoxSwift, depends on pod ObjectBoxC

so that developers can choose specified version of ObjectBox-C and ObjectBox-Swift for development, and to build iOS app with other frameworks that uses ObjectBox.

chzhong avatar Aug 15 '23 09:08 chzhong

Thanks for the suggestion! Using a Go library in an iOS app was not on our radar when we first created the Go and Swift libraries.

Providing a separate pod that contains "just" the ObjectBox C library would require changes to how we build and ship the pods so if at all this won't happen soon. @greenrobot

I guess the short term fix is to ensure that all our released libraries require the same ObjectBox C library version.

greenrobot-team avatar Aug 22 '23 06:08 greenrobot-team

Thnak

Thanks for the suggestion! Using a Go library in an iOS app was not on our radar when we first created the Go and Swift libraries.

Providing a separate pod that contains "just" the ObjectBox C library would require changes to how we build and ship the pods so if at all this won't happen soon. @greenrobot

I guess the short term fix is to ensure that all our released libraries require the same ObjectBox C library version.

Thanks for the reply.

I've worked around this issue and submit a PR to ObjectBox Go that cause the crash.

chzhong avatar Aug 22 '23 07:08 chzhong