ios – Parse Object throws unrecognized selector after I set a property worth

0
27

[ad_1]

I’m utilizing Parse with ObjectiveC to retailer some details about a coloration theme. Right here is my present PFObject mannequin:

CloudThemes.h

#import "Parse/Parse.h"
@interface CloudThemes : PFObject<PFSubclassing>

@property (nonatomic, sturdy) NSDictionary <NSString *, NSDictionary<NSString *, NSString *> *> * themes;

@finish

CloudThemes.m

#import <Basis/Basis.h>
#import "CloudThemes.h"
#import "Constants.h"

@implementation CloudThemes

    @dynamic themes;

+ (nonnull NSString *)parseClassName {
    return kCloudThemesModelClassName;
}
@finish

Every time I attempt to give my themes object a worth, it rejects it, with an error saying

-[CloudThemes setThemes:]: unrecognized selector despatched to occasion 0x283be0000

on the road themes.themes = myTheme;

    CloudThemes * themes = [[CloudThemes alloc] initWithClassName:kCloudThemesModelClassName];
    
    NSDictionary * myTheme = @{@"Cloud": @{@"Background" : @"FEFFFF", @"Secondary" : @"EAEAEA",
                                           @"Label" : @"170A4E", @"Accent" : @"2E6C8B",
                                           @"Like" : @"A3D16E", @"Star" : @"EC6C58", @"StatusBar" : @"Mild"}};
    themes.themes = myTheme;
        [themes saveInBackgroundWithBlock:^(BOOL succeeded, NSError * _Nullable error) {
            if(succeeded){
                NSLog(@"done");
            }
    }];

Hyperlink to the error image:
https://i.stack.imgur.com/otrym.png

Nonetheless, since I used to be utilizing the Back4App dashboard with Parse, I manually added my very own Object that matched every part, to check if I might question for it. Once I queried with:

    PFQuery * question = [PFQuery queryWithClassName: kCloudThemesModelClassName];
    [query whereKeyExists:@"themes"];
    [query findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
        if(error) {
            completion(nil, error);
            return;
        }
        if(objects){
            NSLog(@"found");
            if(objects.count > 0) {
                completion(((CloudThemes *)objects[0]).themes, nil);
            } else {
                completion(nil, nil);
            }
        } else {
            NSLog(@"No objects discovered");
            completion(nil, nil);
        }
    }];

I at all times find yourself with No objects discovered.

I am unsure how that is taking place, any ideas?

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here