ObjectBox Flutter MacOS

162

Update: Since this answer was originally posted, ObjectBox now supports flutter-desktop out of the box. Refer to https://pub.dev/packages/objectbox#getting-started :

For sandboxed macOS apps: specify an application group. Check all macos/Runner/*.entitlements files if they contain a section with correct group ID info. Change the string value to the DEVELOPMENT_TEAM found in Xcode settings, plus an application-specific suffix, for example:

<key>com.apple.security.application-groups</key>
<array>
  <string>FGDTDLOBXDJ.demo</string>
</array>

Original answer:

ObjectBox Flutter desktop support is a work-in-progress, there's a tracking GitHub issue: https://github.com/objectbox/objectbox-dart/issues/166

For now, you have to add the ObjectBox native library libobjectbox.dylib manually using Xcode:

  • get the library from a GitHub release: https://github.com/objectbox/objectbox-c/releases/download/v0.13.0/objectbox-macos-universal.zip
  • Open the yourapp/macos/Runner.xcworkspace in Xcode.
  • Drag your precompiled library (libyourlibrary.dylib) into Runner/Frameworks.
    • Click Runner and go to the Build Phases tab.
      • Drag libobjectbox.dylib into the Copy Bundle Resources list.
      • Under Bundle Framework, check Code Sign on Copy.
      • Under Link Binary With Libraries, set status to Optional.
    • Click Runner and go to the General tab.
      • Drag libobjectbox.dylib into the Frameworks, Libararies and Embedded Content list.
      • Select Embed & Sign.
Share:
162
Mohammed Alfatla
Author by

Mohammed Alfatla

Updated on November 25, 2022

Comments

  • Mohammed Alfatla
    Mohammed Alfatla over 1 year

    How can I make objectbox-dart working also on MacOS

    Flutter: ** BUILD FAILED ** #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:550:9) #2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1157:12) #3 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1009:27) #4 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #5 AppContext.run (package:flutter_tools/src/base/context.dart:149:12) #6 CommandRunner.runCommand (package:args/command_runner.dart:197:13) #7 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:278:9) #8 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #9 AppContext.run (package:flutter_tools/src/base/context.dart:149:12) #10 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:234:5) #11 run.. (package:flutter_tools/runner.dart:64:9) #12 run. (package:flutter_tools/runner.dart:62:12) #13 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #14 AppContext.run (package:flutter_tools/src/base/context.dart:149:12) #15 runInContext (package:flutter_tools/src/context_runner.dart:73:10) #16 main (package:flutter_tools/executable.dart:90:3) Building on xCode Error: ld: library not found for -lobjectbox