Issue with post limit for Nerdfeed


I am trying to set up the post limit for Nerdfeed. I got it working for an arbitrary value that I set myself, but I want this to be configurable via a UIPickerView.

I declared this property in BNRFeedStore.h:

@property (nonatomic, assign) NSInteger cacheRestrictionNumber;

And didn’t synthesize due to auto-synthesization.

Then I made another view controller, with a nib, named “CacheCountPickerViewController”, and set it as the delegate and data source of my UIPickerView.
I put this method in the picker controller:

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
    NSLog(@"row selected = %i", row);
    [[BNRFeedStore sharedStore] setCacheRestrictionNumber:row];
    NSLog(@"updated share variable to %i", [[BNRFeedStore sharedStore] cacheRestrictionNumber]);

But the cache restriction will not change. I’ve tried it with a regular instance variable and writing the getters and setters myself, but no matter what I do I cannot get the instance variable to change its value.

UPDATE: It seems that this issue only occurs when calling the setter from outside the BNRFeedStore class, so I added this method:

- (void)updateRestrictionCountTo:(NSInteger)num;

and called the setter within that, and it seems to be working.

I don’t understand why that is, though? Any ideas?



It turns out that I left out the “static” in this method implementation

+ (BNRFeedStore *)sharedStore {
    static BNRFeedStore *sharedStore = nil;
    if (!sharedStore)
        sharedStore = [[super allocWithZone:nil] init];

   return sharedStore;


Amazing how such a small error can mess things up so much.