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.
When using RealmSwift as a dependency, pod lib validation should succeed.
Pod lib lint returns undefined symbols error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_RLMNotificationToken"
bundle exec pod lib lint --allow-warnings --no-clean --verboseAttaching 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.
Xcode 12
CocoaPods 1.10.0.beta.2
Realm 5.3.5
RealmCore 6.0.19
Having the same issue here.

Xcode 12
Cocoapods 1.9.3
Realm 5.4.3
Seeing the exact same issue here as @mentrena, exact same specs he listed.
facing exact issue here as well... any fixes?
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_RLMNotificationToken", referenced from:
objc-class-ref in RxRealm.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
+1
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
And still facing this issue on:
Xcode 12.0.1
Cocoapods 1.9.3
Realm 10.0.0
Hi,
I'm facing this issue as well. My environment is:
Xcode 12.1
Cocoapods 1.10.0
Realm 5.5.0
@andreadelfante pod lib lint --allow-warnings passes for me using Realm Cocoa 10.1.1 & Cocoapods 1.10
Xcode 12.1
Cocoapods 1.10.0
RealmSwift 10.1.2
Cocoapods still fails to validate.
Steps:
pod lib lint SyncKit.podspec --subspec=RealmSwift --no-cleanUndefined symbols for architecture x86_64:
"_RLMRealmPathForFile"
"_OBJC_CLASS_$_RLMNotificationToken"
"_OBJC_CLASS_$_RealmSwiftObject"
"_OBJC_METACLASS_$_RealmSwiftObject"
Same issue with Xcode 12.2 cocoa pods 1.10
What I discovered is that when building with the no-clean option and opening the generated App.xcworkspace First compilation will fail as well, it will however succeed when tried another time, this time with cleared derived data. Does not help because pod lib lint will still always fail but maybe it helps with debugging
I am also getting the same error for RealmSwiftObject
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_RealmSwiftObject"
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.
Realm dependency:

Realm dependency:

This totally fixed this issue for me, thanks @petropavel13! Closing.
Most helpful comment
Looks like we need to add
Realmtopodspecfile:Otherwise your target will not depend on
RealmdespiteRealmSwifthas dependency onRealm:Looks like coocapods bug.
For example:
Target dependencies in Pods project with implicit
Realmdependency:Target dependencies in Pods project with explicit
Realmdependency: