realm-swift: Using RealmSwift.NotificationToken type when RealmSwift acts as a dependency fails CocoaPods lib lint validation

Goals

Use RealmSwift as a dependency for CocoaPod in Xcode 12. Not sure when this started happening, as this integration was working for couple of years without any issues.

Expected Results

When using RealmSwift as a dependency, pod lib validation should succeed.

Actual Results

Pod lib lint returns undefined symbols error:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RLMNotificationToken"

Steps for others to Reproduce

  1. Clone https://github.com/DenTelezhkin/DTModelStorage, branch cocoapods-enable-realm
  2. Run bundle exec pod lib lint --allow-warnings --no-clean --verbose
  3. Observe build failures.

Code Sample

Attaching CocoaPods-generated project that failed pod lib lint validation for easier debugging:

CocoaPods-Lint-20200923-61087-vg31ow-DTModelStorage.zip

Also build failure can be observed on CI:

https://github.com/DenTelezhkin/DTModelStorage/runs/1154609764?check_suite_focus=true

It seems, that the only issue is with RLMNotificationToken type, because if the code referencing this type is commented out, build succeeds.

Version of Realm and Tooling

Xcode 12 CocoaPods 1.10.0.beta.2 Realm 5.3.5 RealmCore 6.0.19

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 10
  • Comments: 15 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Looks like we need to add Realm to podspec file:

s.dependency "Realm"

Otherwise your target will not depend on Realm despite RealmSwift has dependency on Realm:

Looks like coocapods bug.

For example:

Target dependencies in Pods project with implicit Realm dependency:

Screenshot 2020-11-25 at 14 30 47 Screenshot 2020-11-25 at 14 30 57

Target dependencies in Pods project with explicit Realm dependency:

Screenshot 2020-11-25 at 14 38 54 Screenshot 2020-11-25 at 14 39 19

Hi,

We are facing the same issue as well. Xcode 12 Cocoapods 1.9.3 Realm 5.5.0

Is there any kind of update?

Thanks, Nilit

Having the same issue here.

Screenshot 2020-09-25 at 09 26 55

Xcode 12 Cocoapods 1.9.3 Realm 5.4.3

I am also getting the same error for RealmSwiftObject


Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RealmSwiftObject"