Docs Menu

Docs HomeAtlas Device SDK

Troubleshooting - Flutter SDK

On this page

  • Use Realm with the macOS App Sandbox
  • iOS/iPad OS Bad Alloc/Not Enough Memory Available
  • Connect to App Services Using Android 7 or Older

If you are developing with the Realm Flutter SDK in the macOS App Sandbox, network requests do not work by default due to built-in macOS security settings. Network access is required to use Atlas App Services and Device Sync.

To enable network requests, add the following code to both the files macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements:

<!-- Other entitlements -->
<key>com.apple.security.network.client</key>
<true/>
<!-- Other entitlements -->

You can still use Realm locally without adding this network access permission.

For more information about Flutter development for macOS, refer to Building macOS apps with Flutter in the Flutter documentation.

In iOS or iPad devices with little available memory, or where you have a memory-intensive application that uses multiple realms or many notifications, you may encounter the following error:

libc++abi: terminating due to an uncaught exception of type std::bad_alloc: std::bad_alloc

This error typically indicates that a resource cannot be allocated because not enough memory is available.

If you are building for iOS 15+ or iPad 15+, you can add the Extended Virtual Addressing Entitlement to resolve this issue.

Add these keys to your Property List, and set the values to true:

<key>com.apple.developer.kernel.extended-virtual-addressing</key>
<true/>
<key>com.apple.developer.kernel.increased-memory-limit</key>
<true/>

To use App Services with the Realm SDK on a device using Android 7 or older, you must add an HTTP client with a custom Let's Encrypt Transport Layer Security (TLS) encryption certificate to the App.

This is due to a known issue using Flutter on devices running Android 7 or older to connect to web servers that use Let's Encrypt TLS certificates. As App Services server uses a Let's Encrypt TLS certificate, you must add the custom certificate.

You can download the Let's Encrypt certificate to add to your app by clicking this link: https://letsencrypt.org/certs/lets-encrypt-r3.pem

To set up the custom HTTP client, adapt the following code example to your app.

import 'package:realm_dart/realm.dart';
import "dart:io";
import "dart:convert";
HttpClient createCustomHttpsClient(String cert) {
SecurityContext context = SecurityContext.defaultContext;
try {
final bytes = utf8.encode(cert);
context.setTrustedCertificatesBytes(bytes);
} on TlsException catch (e) {
final message = e.osError?.message ?? "";
if (!message.contains('CERT_ALREADY_IN_HASH_TABLE')) {
rethrow;
}
}
return HttpClient(context: context);
}
App createAppWithCustomHttpsClient(
String letsEncryptCertificate, String appId) {
HttpClient httpClient = createCustomHttpsClient(letsEncryptCertificate);
final appConfig = AppConfiguration(appId, httpClient: httpClient);
return App(appConfig);
}
final letsEncryptCertificate = "<LET'S ENCRYPT CERTIFICATE>";
final appId = "<YOUR APP ID>";
final app = createAppWithCustomHttpsClient(letsEncryptCertificate, appId);
←  Stream Data to Atlas - Flutter SDKTest & Debug - Flutter SDK →