Uploaded image for project: 'Realm Cocoa SDK'
  1. Realm Cocoa SDK
  2. RCOCOA-1249

`RLMCreateObjectInRealmWithValue` failing with `EXC_BAD_ACCESS` in `[RLMObjectId init]`

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Minor - P4 Minor - P4
    • Q2-22FY
    • Affects Version/s: None
    • Component/s: None

      This is occurring in a large application, so we cannot provide sample code. Essentially, when copying RLMObject}}s from one Realm to another, after a few hundred objects are copied, we're experiencing a failure in {{RLMCreateObjectInRealmWithValue with EXC_BAD_ACCESS in [RLMObjectId init]. Although we have the offending code wrapped in a try/catch, it's not throwing an exception and simply killing the app. We have a stack trace which is too large to post here, so if you'd like it emailed, please provide an address.

      The code used to copy objects is basic and akin to the following example;

      dispatch_async(dispatch_get_global_queue(0, 0), ^
      {
          @autoreleasepool
          {
            //Open toRealm and fromRealm...
            
            [toRealm transactionWithBlock:^
            {
                NSArray *objectSchema = fromRealm.configuration.objectClasses;
                for (RLMObjectSchema *schema in objectSchema)
                {
                    RLMResults<RLMObject*> *objects = [fromRealm allObjects:schema.className];
                    for (RLMObject *object in objects)
                    {
                        @try
                        {
                            RLMCreateObjectInRealmWithValue(toRealm, schema.className, object, RLMUpdatePolicyUpdateChanged);
                        }
                        @catch (NSException *exception)
                        {
                            //Handle exception
                        }
                    }
                }
            }];
          }
      }
      

      Realm v10.7.4
      iOS: v14.5
      XCode v12.5

        1. trace.txt
          206 kB
        2. VersoMessage.rtf
          2 kB

            Assignee:
            lee.maguire@mongodb.com Lee Maguire
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: