Skip to content

podfile use_frameworks! #8808

@taojeff

Description

@taojeff

How frequently does the bug occur?

Always

Description

My project is the Object-OC project. This project is a hybrid development using OC and Swift. Recently, I need to start using RealmSwift in the Swift class files. However, I discovered a problem. If I don't include 'use_frameworks!' in the podfile, I always encounter crashes when using Realm to save data in this part of the code.

RLMClassInfo& RLMSchemaInfo::operator[](NSString *name) {
    auto it = m_objects.find(name);
    if (it == m_objects.end()) {
        @throw RLMException(@"Object type '%@' is not managed by the Realm. "
                            @"If using a custom `objectClasses` / `objectTypes` array in your configuration, "
                            @"add `%@` to the list of `objectClasses` / `objectTypes`.",
                            name, name);
    }
    return *&it->second;
}

If I don't use the 'use_frameworks!' configuration, the pod install will encounter such an error.

The Swift pod `RealmSwift` depends upon `Realm`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.

Even if I use 'use_modular_headers!', it will also crash.

Stacktrace & log output

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

20.0.3

What Atlas Services are you using?

Local Database only

Are you using encryption?

Yes

Platform OS and version(s)

iOS13

Build environment

Xcode version: ...
Dependency manager and version: ...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions