Will Ullrich
Will Ullrich

Reputation: 2238

Linker Command Failed With Realm?

I have installed Realm with pods and everything complies. I even have a subclass for two RLMObjects that are to be used to save my custom class objects to realms default space.

@interface RLNotification : RLMObject

- (instancetype)initWithNotification:(KANotification *)notification;

@property NSString *docID, *userID, *username;
@property NSInteger time, type;

@end


@interface RLProfilePicture : RLMObject

- (instancetype)initWithImage:(UIImage *)image;

@property (nonatomic) NSString *userID;
@property (nonatomic) NSData *imageData;
@property NSInteger timeLastUpdated;


@end

PROBLEM

When I go to use these though, in any class, like such:

NSLog(@"test: %@", [RLNotification allObjects]);

RLNotification *noti = RLNotification.new;
noti.userID = @"hey";
noti.username = @"nope!";

[RLMRealm.defaultRealm addObject:noti];

NSLog(@"test2: %@", [RLNotification allObjects]);

I get this warning...

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_RLNotification", referenced from:
      objc-class-ref in AnyClassName.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What on earth am I doing wrong / need to change?....

Upvotes: 1

Views: 422

Answers (1)

Will Ullrich
Will Ullrich

Reputation: 2238

The issue was an anomaly. I removed Realm from my pod file, cleaned, deintegrated, updated Cocoa, installed, the whole process.

Did this easily 4 times, 5th time worked. 🤷‍♂️

Upvotes: 1

Related Questions