Usar Realm con la zona protegida de aplicaciones macOS
Si estás desarrollando con el Realm Flutter SDK en el Sandbox de la aplicación de macOS, las solicitudes de red no funcionan por defecto debido a las configuraciones de seguridad incorporada en macOS. Se requiere acceso a la red para usar Atlas App Services y 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.
Para obtener más información sobre el desarrollo de Flutter para macOS, consulte Creación de aplicaciones macOS con Flutter en la documentación de Flutter.
iOS/iPad OS Bad Alloc/Not Enough Memory Available
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
Este error normalmente indica que un recurso no se puede asignar porque no hay suficiente memoria disponible.
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/>
Connect to App Services Using Android 7 or Older
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"; IOClient 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 IOClient(HttpClient(context: context)); } App createAppWithCustomHttpsClient( String letsEncryptCertificate, String appId) { IOClient ioClient = createCustomHttpsClient(letsEncryptCertificate); final appConfig = AppConfiguration(appId, httpClient: ioClient); return App(appConfig); } final letsEncryptCertificate = "<LET'S ENCRYPT CERTIFICATE>"; final appId = "<YOUR APP ID>"; final app = createAppWithCustomHttpsClient(letsEncryptCertificate, appId);