Skip to content

Commit 50d54e7

Browse files
Store: improve docs for sandboxed macOS apps, add internal notes
1 parent 60a5f44 commit 50d54e7

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

objectbox/lib/src/native/store.dart

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,18 @@ class Store implements Finalizable {
128128
///
129129
/// Case sensitivity can also be set for each query.
130130
///
131-
/// ## macOS application group
131+
/// ## Sandboxed macOS apps
132132
///
133-
/// When creating a sandboxed macOS app use [macosApplicationGroup] to
134-
/// specify the application group.
133+
/// To use ObjectBox in a sandboxed macOS app, [create an app group](https://developer.apple.com/documentation/xcode/configuring-app-groups)
134+
/// and pass the ID to [macosApplicationGroup].
135135
///
136-
/// This string value is the `DEVELOPMENT_TEAM` you can find in your Xcode
137-
/// settings, plus an application-specific suffix.
138-
/// Also check that all `macos/Runner/*.entitlements` contain a <dict> section
139-
/// with this value, for example:
136+
/// Note: due to limitations in macOS the ID can be at most 19 characters long.
137+
///
138+
/// By convention, the ID is `<Developer team ID>.<group name>`.
139+
///
140+
/// You can verify the ID is correctly configured, by checking that the
141+
/// `macos/Runner/*.entitlements` files contain the relevant key and value,
142+
/// for example:
140143
///
141144
/// ```
142145
/// <dict>
@@ -147,7 +150,10 @@ class Store implements Finalizable {
147150
/// </dict>
148151
/// ```
149152
///
150-
/// Note: due to limitations in macOS the value must be at most 19 characters.
153+
/// This is required to enable additional interprocess communication (IPC),
154+
/// like POSIX semaphores, used by mutexes in the ObjectBox database library
155+
/// for macOS. Specifically, macOS requires that semaphore names are prefixed
156+
/// with an application group ID.
151157
///
152158
/// ## Maximum database size
153159
///
@@ -231,6 +237,12 @@ class Store implements Finalizable {
231237
ArgumentError.value(macosApplicationGroup, 'macosApplicationGroup',
232238
'Must be at most 20 characters long');
233239
}
240+
// This is required to enable additional interprocess communication
241+
// (IPC) in sandboxed apps (https://developer.apple.com/documentation/xcode/configuring-app-groups),
242+
// like POSIX semaphores, used by mutexes in the ObjectBox database
243+
// library. macOS requires that semaphore names are prefixed with an
244+
// application group ID.
245+
// See the constructor docs for more details.
234246
withNativeString(macosApplicationGroup, C.posix_sem_prefix_set);
235247
}
236248
_checkStoreDirectoryNotOpen();

0 commit comments

Comments
 (0)