3

My code is handling the response from an API client object, as a delegate of that object.

I've confirmed in the debugger that I'm getting the data I expect and everything seems fine. It populates the RLMObject subclass "Question" object just fine.

-(void)apiClientReturnedData:(NSDictionary *)data withIdString:(NSString *)idString
{
    NSDictionary *questions = data[@"questions"];


    for (NSDictionary *q in questions) {

        Question *question = [[Question alloc] init];

        // Populate the question from the incoming data,
        // omitted as irrelevant. I'm confident it's working.

        RLMRealm *realm = [RLMRealm defaultRealm];
        [realm beginWriteTransaction];
        [realm addObject:question];
        [realm commitWriteTransaction];
    }

}

My UI is awaiting an update until this all returns.

When I step through this in the debugger, at the line [realm beginWriteTransaction], the debugger stops debugging (as if I hit "Continue Execution" button) and the UI updates as if this method had completed. No data gets written to the Realm, per the Realm Browser.

It's as if instead of that beginWriteTransaction line, it was a break. It appears to jump out of the for loop, and end the debug session. Nothing in the log.

What gives?

Dan Ray
  • 21,623
  • 6
  • 63
  • 87

0 Answers0